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!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Change color of a Group.

    Scheduled Pinned Locked Moved SketchyPhysics
    4 Posts 3 Posters 2.2k 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.
    • H Offline
      hpnisse
      last edited by

      Hello.
      Can I change color of a group with script in SP3?
      Example: Change color of a Light from red to green or something else. (the light is a group)

      Thanks for any help, hope you understand.

      ` /hpnisse`
      ` Windows 7 U -Sketchup 8 -SketchyPhysics 3.2-Dec2 - from Sweden`

      1 Reply Last reply Reply Quote 0
      • C Offline
        CPhillips
        last edited by

        It would be possible with the SP3x version. You would have to use the sketchup api to change the material on the group.

        1 Reply Last reply Reply Quote 0
        • H Offline
          hpnisse
          last edited by

          Okay,
          I'm not a Sketchup API friend so it would be hard for me to do.
          But thanks for answer.

          by the way, I have the SketchyPhysics3x Jun 27 version.
          And it works perfect.

          /hpnisse

          ` /hpnisse`
          ` Windows 7 U -Sketchup 8 -SketchyPhysics 3.2-Dec2 - from Sweden`

          1 Reply Last reply Reply Quote 0
          • W Offline
            Wacov
            last edited by

            Paint the group with the default material in the places you want the color to change. There are probably a few ways to script this, but one is:

            @m = Sketchup.active_model.materials.add "My material"
            group.material = @m
            
            @m.color="Red"
            

            "Red" could be any color name, and you do need to use the quotes. Or you can use an r,g,b value... [100,100,100], for example, will give a shade of gray. The name of the material, in this case, "My material", is of no real consequence, as SU will stick a number on the end if the name is already being used. You should be able to change the color during the sim with:

            @m.color = ...
            

            In ontick, or whatever. You can also do other stuff with the material, like use a texture, or make it transparent... see The API for more info. Good luck!

            http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

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

            Advertisement