Change Color of a model
-
Hey there
I got a little question about changing the color of a model...
I have generated a table with ruby. Now I want to change the color or/and the material of it.
How can I do that?
Thanks a lot
Cheers,
gogcam -
You can use either color by layer (from the layer window) or just use the paint bucket tool choosing the material you want to apply
-
You can do it two ways, depending on how you have made the table.
The if the table is a group or component (g/c), you can apply a Material (or Color) to the g/c. If not, you can apply the Material or Color to each face (and/or edge). If you get stuck, post some code.
Todd
-
w = 2500.mm d = 2000.mm h = 1000.mm pts = [[0,0,h-40.mm], [w,0,h-40.mm], [w,d,h-40.mm], [0,d,h-40.mm]] base = container.add_face pts h = -h if base.normal.dot(Z_AXIS) < 0.0 base.pushpull 40.mm
Thats the main code for the base of the table. Sadly I have no clue how I can change the material or color of it. I googled a lot but somehow I didnt find anything really useful for a ruby newbie like me
Thanks for your help!
gogcam -
Try this:
w = 2500.mm d = 2000.mm h = 1000.mm pts = [[0,0,h-40.mm], [w,0,h-40.mm], [w,d,h-40.mm], [0,d,h-40.mm]] group = Sketchup.active_model.entities.add_group container = group.entities ; base = container.add_face pts h = -h if base.normal.dot(Z_AXIS) < 0.0 base.pushpull 40.mm group.material = "red" ;
Todd
Advertisement