[REQUEST] Pick up layer from object
-
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. -
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...
-
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
-
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 -
@numerobis said:
WOW! that was fast!
IT WORKS! Thank You very much! very helpfulIt did take 9 minutes... but I did have to make the file and test it...
-
@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 objectOh gotcha, my mistake. Yes, that is a pretty standard workflow in autocad.
Chris
-
You can do it :
- Select entities
- Go to windows "entity info"
- Change layer in the list.
It works here!
-
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
-
Ah ok!!
I made a similar script for me some time ago...
Great work TIG! -
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...
Advertisement