ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
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.
Advertisement