Advertisement
Guest User

Untitled

a guest
Sep 6th, 2017
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.20 KB | None | 0 0
  1.  
  2. import rhinoscriptsyntax as rs
  3. import re
  4. import scriptcontext as sc
  5. import Rhino
  6. import getLayerList
  7.  
  8. def main():
  9.     rs.EnableRedraw(enable=False)
  10.  
  11.     topList = []
  12.     topList = sorted(getLayerList.getLayers("3D","3dm"))
  13.    
  14.     thisLayer = rs.CurrentLayer()
  15.    
  16.     topList.append("TURN ALL ON")
  17.     destinationLayer = rs.ListBox(topList, "Layer To Activate")
  18.    
  19.    
  20.    
  21.     if not destinationLayer:
  22.         print("No Layer Selected")
  23.         return None
  24.        
  25.     elif destinationLayer == "TURN ALL ON":
  26.         topList.remove(destinationLayer)
  27.         for layer in topList:
  28.             sc.doc = Rhino.RhinoDoc.ActiveDoc
  29.             rs.LayerVisible(layer, True)
  30.             rs.ExpandLayer(layer, False)
  31.            
  32.     else:
  33.         topList.remove("TURN ALL ON")
  34.         topList.remove(destinationLayer)
  35.         rs.CurrentLayer(layer = destinationLayer)
  36.         rs.ExpandLayer(destinationLayer, True)
  37.         for layer in topList:
  38.             sc.doc = Rhino.RhinoDoc.ActiveDoc
  39.             rs.LayerVisible(layer, False)
  40.             rs.ExpandLayer(layer, False)
  41.            
  42.     print(destinationLayer)
  43.     rs.EnableRedraw(enable=True)
  44.  
  45. if __name__=="__main__":
  46.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement