Skip to content

Instantly share code, notes, and snippets.

@yasushisakai
Last active December 11, 2015 21:18
Show Gist options
  • Save yasushisakai/4660841 to your computer and use it in GitHub Desktop.
Save yasushisakai/4660841 to your computer and use it in GitHub Desktop.
VERY VERY simple script to change the current layer to the selected object. I run this as a command and set "CL" as an alias. Maybe there is the same built-in command...similar I found was "ChangeToCurrentLayer",which changes the object's layer to the current layer. be sure to save this to the folder that rhino searches when opening.(Rhinoceros/…
import rhinoscript.userinterface
import rhinoscript.geometry
import rhinoscriptsyntax as rs
__commandname__ = "CurrentLayer"
def RunCommand( is_interactive ):
'''
CurrentLayer:
changes the current layer to the same as the selected objects layer.
'''
obj = rs.GetObject('select object to change current Layer',preselect=True,select=False)
if obj==None:
return 1
objLayer = rs.ObjectLayer(obj)
rs.CurrentLayer(objLayer)
return 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment