Change color of a Group.
-
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.
-
It would be possible with the SP3x version. You would have to use the sketchup api to change the material on the group.
-
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
-
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!
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