• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Change Color of a model

Scheduled Pinned Locked Moved Developers' Forum
5 Posts 3 Posters 615 Views
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.
  • G Offline
    gogcam
    last edited by 6 Mar 2008, 09:32

    Hey there

    I got a little question about changing the color of a model...

    I have generated a table with ruby. Now I want to change the color or/and the material of it.

    How can I do that?

    Thanks a lot
    Cheers,
    gogcam

    1 Reply Last reply Reply Quote 0
    • G Offline
      Gjenio
      last edited by 6 Mar 2008, 10:21

      You can use either color by layer (from the layer window) or just use the paint bucket tool choosing the material you want to apply

      1 Reply Last reply Reply Quote 0
      • T Offline
        todd burch
        last edited by 6 Mar 2008, 13:11

        You can do it two ways, depending on how you have made the table.

        The if the table is a group or component (g/c), you can apply a Material (or Color) to the g/c. If not, you can apply the Material or Color to each face (and/or edge). If you get stuck, post some code.

        Todd

        1 Reply Last reply Reply Quote 0
        • G Offline
          gogcam
          last edited by 10 Mar 2008, 15:30

          
          w = 2500.mm
          d = 2000.mm
          h = 1000.mm
          
          pts = [[0,0,h-40.mm], [w,0,h-40.mm], [w,d,h-40.mm], [0,d,h-40.mm]]
          base = container.add_face pts
          h = -h if base.normal.dot(Z_AXIS) < 0.0
          base.pushpull 40.mm
          
          

          Thats the main code for the base of the table. Sadly I have no clue how I can change the material or color of it. I googled a lot but somehow I didnt find anything really useful for a ruby newbie like me 😞

          Thanks for your help!
          gogcam

          1 Reply Last reply Reply Quote 0
          • T Offline
            todd burch
            last edited by 10 Mar 2008, 16:35

            Try this:

            
            w = 2500.mm
            d = 2000.mm
            h = 1000.mm
            
            pts = [[0,0,h-40.mm], [w,0,h-40.mm], [w,d,h-40.mm], [0,d,h-40.mm]]
            
            group = Sketchup.active_model.entities.add_group
            container = group.entities ; 
            
            base = container.add_face pts
            h = -h if base.normal.dot(Z_AXIS) < 0.0
            base.pushpull 40.mm
            
            group.material = "red" ; 
            
            

            Todd

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            1 / 1
            • First post
              1/5
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement