Assign a texture to a group or component instance?
-
I can do it with the built-in ability of sketchup but I don't see a method to do it in Ruby. I'd prefer not to have to go into the sub-entities of a group and color all the items that don't have a material. Is there a trick?
-
Hi Fiz, the parent class of Groups and Components is the Drawingelement class. Anything that you can do to the Drawingelement class, you can do to its subclasses. So check out the Drawingelement class and you will see that you can assign materials to any drawingelement. Although, as I'm writing this, I'm having my doubts about it. That would indicate that color can be assigned to some things that I've never thought about assigning color to. I'm off to go experiment now.
But the point is, that yes you just assign the material to a group or componentinstance like this:
color = Sketchup::Color.new [0,0,200] my_group.material = color
Chris
-
I think I see - section cuts and guides are specifically what I was thinking of that can not take individual color. Which is sort of true. They seem to ignore it if you change their color individually through ruby. But they do have color associated with them globally and it seems Ruby color is ignored. So I think my above thoughts are still correct, that anything you can do to the Drawingelement class can be done to its subclasses. I think.
Chris
-
Thanks Chris!
Forgot all about the parent class idea. Still wrapping my head around this object-oriented approach.
Advertisement