sketchucation logo sketchucation
    • Login
    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!
    🚨 Skimp | 25% Off until March 30 Buy Now

    How to add texture on a plane into a script?

    Scheduled Pinned Locked Moved Developers' Forum
    5 Posts 3 Posters 639 Views 3 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S Offline
      sahi
      last edited by

      How to add texture on a plane into a script?

      
      material = model.materials
      base = entities.add_face(pts)
      base.material = ????
      
      
      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by

        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.

        Hi

        1 Reply Last reply Reply Quote 0
        • S Offline
          sahi
          last edited by

          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!

          1 Reply Last reply Reply Quote 0
          • S Offline
            sahi
            last edited by

            how to place texture on a center?

            position_material  ????
            

            Dom_5.jpg

            1 Reply Last reply Reply Quote 0
            • R Offline
              RickW
              last edited by

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

              RickW
              www.smustard.com

              1 Reply Last reply Reply Quote 0

              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 Login
              • 1 / 1
              • First post
                Last post
              Buy SketchPlus
              Buy SUbD
              Buy WrapR
              Buy eBook
              Buy Modelur
              Buy Vertex Tools
              Buy SketchCuisine
              Buy FormFonts

              Advertisement