I have a dummy question, Why does not this command work?
import rhinoscriptsyntax as rs
id= rs.GetObjects("")
filepath= “”“C:\Users\partcad\test.3dm”""
s=rs.Command("_Export_SelID " + str(id) + str(filepath) + " _Enter" )
print s
I have a dummy question, Why does not this command work?
import rhinoscriptsyntax as rs
id= rs.GetObjects("")
filepath= “”“C:\Users\partcad\test.3dm”""
s=rs.Command("_Export_SelID " + str(id) + str(filepath) + " _Enter" )
print s
GetObjects() returns a list of objects, SelID wants a single object ID.
There is an optional argument in GetObjects() to select the objects, use that, and eliminate the SelID part in your export string…
Example:
import rhinoscriptsyntax as rs
ids= rs.GetObjects(select=True)
#ids is a list of objects, or None if nothing has been selected
if ids:
#enclose the file path in double quotes and again in single quotes (trick)
filepath= '"C:\Users\partcad\test.3dm"'
#don't forget to put spaces where needed in the command string
rs.Command("_-Export " + filepath + " _Enter")
if rs.LastCommandResult()==0: print "Success"