Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download
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] # ColorIf 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 = matIf 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 = matNote 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 = matThank 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