I’ve been using python for rhino on a mac. I am wondering if someone could show me an example of how to call Export from python. I’d like to duplicate the functionality of this export by layer rhinoscript:
http://wiki.mcneel.com/developer/scriptsamples/exportlayerobjects
I would be grateful for any help.
Craig
djordje
February 15, 2014, 12:38am
2
Hi Craig,
This script will work on Windows Rhino:
exportLayerObjects.py (499 Bytes)
import rhinoscriptsyntax as rs
layers = rs.LayerNames()
splitLayers = []
for layer in layers:
split = layer.split("::")
splitLayers.append(split[-1])
for layer in splitLayers:
ids = rs.ObjectsByLayer(layer)
if ids:
selIds = ""
for id in ids:
selIds = selIds + "_SelId " + str(id) + " "
commandString = "-_Export " + selIds + " _Enter " + chr(34) + layer + ".stl" + chr(34) + " _Enter " + "_Enter"
rs.Command(commandString)
Have no idea whether or not it will work on Mac too, as I have never used that Rhino version.
@djordje , Thank you very much!
The commandString idea is a clever tool that I can use again.
Craig