ExportwithOrigin in RhinoScriptSyntax (Python)

How would I script ExportwithOrigin in rhinoscriptsyntax Command()?

This won’t work:

rs.Command('-_ExportWithOrigin (1,2,3) "c:/folder/filename.3dm" _EnterEnd')

What am I doing wrong?

Thanks all.

Hello - something like this"

rs.Command("_-ExportWithOrigin " +"1,2,3 " + " " + chr(34)+ “C:\Users\Student\OneDrive\Desktop\Junk” + chr(34) )

-Pascal

Sorry, but I can’t imagine this being right.
It would concatenate to:
rs.Command("_-ExportWithOrigin 1,2,3 " “C:\path\to\file.3dm” " )
Python cannot use left and right quotation marks in code, only straight ones.

It’s Discourse that adds these unfortunately by default, so either you need to specifically format your code as a code block when posting here, or if you copy something that is formatted as normal text from here and paste somewhere else you will need to fix them yourself after…

I might do it this way:

import rhinoscriptsyntax as rs
filepath=r"C:\Users\username\Desktop\testfile.3dm"
ip=rs.coerce3dpoint([1,2,3])
rs.Command('_-ExportWithOrigin {} {}'.format(ip,filepath))
  • You need to use a raw string ('r' prefix) for the file path, or escape the backslashes by using double backslashes.
  • The format method will automatically format your 3d point as a string.
1 Like

@Helvetosaur thanks!

@Helvetosaur
Sorry, maybe you know what’s happening, because the filename is asked for:

Also the Insertion Base Point seems to be one value instead of a coordinate?

What does your filename/path look like? It needs to be the full path to the file including name and extension, as a raw string.

So whatever you are putting in there is a single number, not a 3dPoint. Either you need to supply it with a string "x,y,z" or you need to get the coordinates of the 3dpoint and convert that to a string (rs.Command only accepts text strings). The format method above does this automatically, there are other ways such as rs.Pt2Str(pt)