sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    [REQUEST] Pick up layer from object

    Scheduled Pinned Locked Moved Plugins
    10 Posts 4 Posters 851 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.
    • N Offline
      numerobis
      last edited by

      Hi,

      would it be possible to write a little ruby that lets you switch to the layer of a selected object?
      AutoCAD has this function and it is very useful. it would be good if it could be assigned to a key and would be started temporary. after selecting the object it switches back to the last used tool.

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

        This is the basis

        require 'sketchup.rb'
        def currentLayerFromSelected
          Sketchup.active_model.active_layer = Sketchup.active_model.selection[0].layer
        end#def
        if not file_loaded?(File.basename(__FILE__))
          UI.menu("Plugins").add_item("Current Layer from Selected"){currentLayerFromSelected}
        end#if
        file_loaded(File.basename(__FILE__))
        
        

        Paste all of the code into a file named 'currentLayerSelection.rb' [or something-like], shortcut it to its Plugins title...

        TIG

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

          You can also turn on the layers toolbar. View > Toolbars > Layers.

          Then you just select the item, click on the layers drop down list in the toolbar and select the layer you want to move the object to.

          Chris

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

          1 Reply Last reply Reply Quote 0
          • N Offline
            numerobis
            last edited by

            WOW! that was fast! 😎 πŸ˜„
            IT WORKS! Thank You very much! very helpful

            @Chris:
            thank you too! but i don't want to move the item, but change the current layer to the layer of the selected object

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

              @numerobis said:

              WOW! that was fast! 😎 πŸ˜„
              IT WORKS! Thank You very much! very helpful

              It did take 9 minutes... but I did have to make the file and test it... πŸ€“

              TIG

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

                @numerobis said:

                @Chris:
                thank you too! but i don't want to move the item, but change the current layer to the layer of the selected object

                Oh gotcha, my mistake. Yes, that is a pretty standard workflow in autocad.

                Chris

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

                1 Reply Last reply Reply Quote 0
                • M Offline
                  Matt666
                  last edited by

                  You can do it :

                  • Select entities
                  • Go to windows "entity info"
                  • Change layer in the list.

                  It works here!

                  Frenglish at its best !
                  My scripts

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

                    Same mistake as Me Matt, he doesn't want to change the layer than an object is on.

                    He wants to change the "Current Layer". Its the equivalent of opening the Layer dialog and clicking on the circle button (radio button) to change the current layer that you will be modeling on.

                    Chris

                    PS - Just a thought about why we both were confused about the request. In Cad, you always model on the layer you want the line to be on. So make all curb lines on LS_Curb_8 or whatever. In SU, you always want to model on Layer 0 and only MOVE entire groups and components onto other layers. So in SU, a standard workflow rarely changes the current layer, but often moves objects to other layers.

                    That being said, feel free to do it however you want. You might run into problems later if you have geometry on layers other than 0. But TIG has made a PERFECT script to fix that up too if you ever need it πŸ˜„

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

                    1 Reply Last reply Reply Quote 0
                    • M Offline
                      Matt666
                      last edited by

                      Ah ok!! 😳
                      I made a similar script for me some time ago...
                      Great work TIG!

                      Frenglish at its best !
                      My scripts

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

                        I agree - more times than not you should model on Layer0, then put the collection of bits as groups/component-instances on different layers... This method let's you change the current layer BUT be careful to keep your raw geometry on Layer0...

                        TIG

                        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