Help hiding groups and components from Ruby prompt.
-
I need to setup a method of hiding certain objects in my scene from ruby command. Said items might be groups or components. I would like to add a custom attribute named "HideThis" to all my models (groups/components) and give it a value either 0 or 1, 1 would be equal to hidden. I was thinking I could grep my active entities and check for HideThis=1, if true then .hidden=true... something like that. That is my idea, I could use some help with syntax/method making that happen. I have no idea as to how to access custom attribute values from ruby. Any direction would be appreciated. Thanks in advance.
-
entity.set_attribute('MySection', 'HideThis', true) entity.get_attribute('MySection', 'HideThis', false)
http://www.sketchup.com/intl/en/developer/docs/ourdoc/entity#get_attribute
http://www.sketchup.com/intl/en/developer/docs/ourdoc/entity#set_attribute -
Thanks ThomThom,
I am quickly realizing that messing with component attributes is a pain in the arse, especially dynamic ones. I will probably rethink this idea a bit. -
Oh, you where meaning dynamic component attributes?
-
Heh, I opened that can of worms and closed it real quick. I went to an array from a list of model names to hide. I am much happier this way. Thanks
Advertisement