Sketchup.active_model.materials.current behaviour
-
I am writing a script to change the material for specific part of the model. The idea is that the user will select a material from the Materials window then they will run the script which will use the current material to change some parts of the active model. To get the current material I am using Sketchup.active_model.materials.current. This seems to return the last material that was used (i.e. you actually have to apply it to a face), selecting a new material in the Materials window is not sufficient to change the value of Sketchup.active_model.materials.current.
Any suggestions on how I can determine the material that is selected in the Materials window?
-
I don't see that behaviour. When the selected material is changed,
Sketchup.active_model.materials.currentreflects that.
(SU7) -
When do you call that method?
-
Here is a simple example using the Ruby Console:
Show the current material:
> printf "%s\n", Sketchup.active_model.materials.current.name \[Color_D05] nilSelect a new material in the materials window, check the current material again:
> printf "%s\n", Sketchup.active_model.materials.current.name \[Color_D05] nilFill a face with the new material, then check the current material:
> printf "%s\n", Sketchup.active_model.materials.current.name \[Color_F09] nilSketchup.active_model.materials.current does not change until the last step
-
Maybe it's a Mac bug. Because on my PC it updates correctly.
I'll test on my mac later when I get time.
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