sketchucation logo sketchucation
    • Login
    1. Home
    2. spratman
    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!
    🫛 Lightbeans Update | Metallic and Roughness auto-applied in SketchUp 2025+ Download
    S
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Groups 1

    spratman

    @spratman

    0
    Reputation
    1
    Profile views
    2
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    spratman Unfollow Follow
    registered-users

    Latest posts made by spratman

    • RE: Sketchup.active_model.materials.current behaviour

      Here is a simple example using the Ruby Console:

      Show the current material:

      
       > printf "%s\n", Sketchup.active_model.materials.current.name
       \[Color_D05]
       nil
      
      

      Select a new material in the materials window, check the current material again:

      
       > printf "%s\n", Sketchup.active_model.materials.current.name
       \[Color_D05]
       nil
      
      

      Fill a face with the new material, then check the current material:

      
       > printf "%s\n", Sketchup.active_model.materials.current.name
       \[Color_F09]
       nil
      
      

      Sketchup.active_model.materials.current does not change until the last step

      posted in Developers' Forum
      S
      spratman
    • 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?

      posted in Developers' Forum
      S
      spratman