Add note to material library

Hi!

Does anyone know if it's possible to add a note to a material. Not like a map. More like info stored in the material library file.

Thanks!

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Andreas G's picture

This is great! But if I use

This is great!
But if I use example#2 and at a later time wan't to access the note how do I do that? I tried a few ways but I can't seem to get it to work.

Thanks so much for your help!

barigazy's picture

...

What do you try?

barigazy

Andreas G's picture

First I add the ca to the

First I add the ca to the material, then I add it to a matlib and saves it. At a later time I wan't to load that matlib and access the note and print it to a edittext

I'm trying to access the note with custAttributes.get mat materialNote but all I get is undefined

Thanks

barigazy's picture

Let's say you put material

Let's say you put material from the library which already have note inside to material slot 3.
Now to get note simply use

meditMaterials[3].mtlNote.note

If you assigne that material to en object (Box001 for example) then you can use

$Box001.material.mtlNote.note

And to set new note just do

$Box001.material.mtlNote.note = "This is my new material"

barigazy

Andreas G's picture

That was easy! Thanks again!

That was easy! Thanks again!

Andreas G's picture

Thanks for the reply! I'm

Thanks for the reply!
I'm going to look at it today.

barigazy's picture

example #2 (visible notes)

Also you can add new rollout inside any material

--CA definition
materialNote = attributes mtlNote
(
	parameters notesParm rollout:notesRoll
	(
		note type:#string ui:et_note
	)
	rollout notesRoll "Material Note"
	(
		edittext et_note height:100
	)
)
-- example (you can use any material from ME, from object, from library)
mtl = meditMaterials[1]
-- the next line will assigne new rollout to material only if not exists
if not (isProperty mtl #mtlNote) do custAttributes.add mtl materialNote
-- now you can get/set some text
mtl.mtlNote.note = "Standard gray material"
--or if you want to extend existing note
mtl.mtlNote.note += "\nStandard gray material"
-- open material editor and look "Material Note" rollout inside first matrial. 

barigazy

barigazy's picture

example (hidden notes)

-- define and store note in variable
txt = "This is a custom material note text.\nCheck similar example in MXS Help."
--define custom attributes to hold main function
materialNote = attributes mtlNote
(
	fn getNote = (format "Note: %\n" txt)
)
-- example (you can use any material from ME, from object, from library)
mtl = meditMaterials[1]
--assigne CA to material
custAttributes.add mtl materialNote
---------------------------------------------------------
-- now to get note you need first to get material CA
ca = custAttributes.get mtl materialNote
-- then check if ca exists but if not send a message
if ca != undefined then ca.getNote() else messageBox "This material not have any note!" title:"MaterialNote" beep:off

barigazy

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.