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

    Current material in material browser

    Scheduled Pinned Locked Moved Developers' Forum
    7 Posts 4 Posters 378 Views 4 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.
    • B Offline
      BillW
      last edited by

      I have searched through the docs to find a call that returns a reference to the currently selected material in the material browser - to no avail. I was hoping for a call active_material

      Does anyone have any ideas?

      Thanks

      Bill Wood

      1 Reply Last reply Reply Quote 0
      • J Offline
        Jim
        last edited by

        Hi Bill,

        It is:

        Sketchup.active_model.materials.current

        Hi

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          cmat=Sketchup.active_model.materials.current
          cmatName=cmat.name
          Sketchup.active_model.materials.current="AnExistingMaterialNameInModel" # or a e.g. #<Sketchup;;Material;0xa5eb790>
          

          returns the current material, its name and will change the current-material to another pre-existing one...

          TIG

          1 Reply Last reply Reply Quote 0
          • B Offline
            BillW
            last edited by

            Excellent! Thanks very much Jim and Tig.

            This will come in handy. I am converting some of my Studio Max tools and am using wxSU to create some very sophisticated autosizing dialogs all working in ruby (no javascript/web pages). I am a fan of wxSU even though there are some rough edges.

            Regards

            Bill Wood

            1 Reply Last reply Reply Quote 0
            • Chris FullmerC Offline
              Chris Fullmer
              last edited by

              Hi BillW, just to pass on a warning about WxSU....but apparently it has some issues. Adam Billyard (AdamB here on the forum and the developer of LightUp) said he is finding that having it installed might interfere with other non-related Rubies (specifically some things he's working on). I think he also said that he is contact with the person that is developing WxSU and trying to get some of those rough edges resolved. And that is all I know.

              Chris

              Lately you've been tan, suspicious for the winter.
              All my Plugins I've written

              1 Reply Last reply Reply Quote 0
              • B Offline
                BillW
                last edited by

                Hi Chris
                I did notice Adam Billyard's comments. I am working on the assumption that the wxSU rough edges will be ironed out and am skirting around any current problem areas. Also, I probably wont be using Lightup anyway. As I understand it there is a more recent version of wx which can be downloaded and used to overwrite parts of the wxSU installation, but I will leave that till wxSU is updated.

                Thanks

                Bill

                1 Reply Last reply Reply Quote 0
                • Chris FullmerC Offline
                  Chris Fullmer
                  last edited by

                  Sounds like a plan to me!

                  Lately you've been tan, suspicious for the winter.
                  All my Plugins I've written

                  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