đź’ˇ LightUp 7.1 | SketchUp's only real-time renderer that uses object-based rendering
Download Trial
How to add texture on a plane into a script?
-
How to add texture on a plane into a script?
material = model.materials base = entities.add_face(pts) base.material = ????
-
From here: http://download.sketchup.com/OnlineDoc/gsu6_ruby/Docs/ruby-drawingelement.html#material=
material = drawingelement.material = material | "materialname" | color | "colorname"
The right-hand-side can be a Material object, a material name (String), a Color object, or a color name (String)
So...
base.material = Sketchup;;Color.new(255, 0, 0) # Color base.material = 255 # Color base.material = 0xff # Color base.material = "red" # Color base.material = "#ff0000" # Color base.material = [1.0, 0.0, 0.0] # Color base.material = [255, 0, 0] # Color
If you want to use a Material that is already in the Model, you can get it through the Materials object.
mat = Sketchup.active_model.materials["Material Name"] base.material = mat
If you want to create a new Material from a image file:
mat = Sketchup.active_model.materials.add "New Material Name" mat.texture = "c;\\path\\to\\texture\\image.png" base.material = mat
Note this is from the API documentation and may contain inaccuracies.
-
mat = Sketchup.active_model.materials.add "New Material Name" mat.texture = "c;\\path\\to\\texture\\image.png" base.material = mat
Thank you! Thank you! Thank you!
-
how to place texture on a center?
position_material ????
-
Need to use a UVHelper - set the middle coordinate of the texture to be the same as the middle coordinate of the face (is one way).
Advertisement