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).
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