Assign a material in the ruby console
-
I have tried to add a material to some of the faces in my model and I get the error material [Brick_Antique]" not found. Could someone show me the correct way to assign a material to a face
for i in 1..10 faces[i].material= "[Brick_Antique]" -
Hi, here is an example;
model = Sketchup.active_model ; ents = model.entities ; materials = model.materials ; m = materials.add "name for material" ; texture = m.texture = "c;\\Users\\User\\Desktop\\folder\\texture.jpg" ; m.texture.size = 60 ; use_texture = true ; #Change to false to use color only faces = ents.grep(Sketchup;;Face) ; faces.each do |e| if use_texture e.material = m else e.material = [190,190,190] #Use color instead of textures end ; end ;Note: By the way there is a Developers forum section which might get you better answers to your questions.
Cheers!
-
Thanks that worked really well.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement