Macro Creation

I would like to create a macro or script that I can link to a toolbar button.
I need the macro/script to do the following:

Save current drawing (3DM or DWG) using the current filename to a DWG file (in the current folder).

Any help would be much appreciated. Thank you.

Hello - it is easy enough to script but dwg has export schemes - you’ll need to know what that is.


I use the 2007 Solids for this workflow. It includes opening and review or minor modifications of hundreds of files in a day.

Hello - the gotcha that I see is when you open a dwg file - the Rhino file has not been saved, and there is no path or file name available. Rhino shows a file name at the top of the window but so far I do not see how to get that name in a script.

The upshot is, unless I find some magic way, we either need to open the non-3dm file from a script as well, so that I can keep track of the name, or ask every time when you saveAs


Ah ok, thank you for taking a look at it. All of these review files are DWG to start with so I don’t have an option in that direction.

OK - I’ll make two, when I get a chance - one to open, and one to saveAs.

@wm_c - see if this does the right thing… you will need to be careful - if you open a file other than with the opener here, the cached file name and the actual file name will get out of sync and the save will do a very bad thing - you may want to confirm the name during the SaveAs operation - it is an extra step, but probably a good thing.

To use the Python script use RunPythonScript, or a macro:

_-RunPythonScript "Full path to py file inside double-quotes" (821 Bytes) (891 Bytes) (1.1 KB)


1 Like

Thank you sir!

Thank you Pascal.