Possibilities for an exporting script?

Hello,

I’m currently using already using a script to make exporting files a little easier.
The script automatically sets the export folder to be the same as the current working folder. And it also copies the path of the folder to the clipboard.

The script was written by Pascal on the forum, thanks again, it’s been serving me well for a few years now :slight_smile:

Now I’m wondering if any of the following features would be possible?

  • Automatically set the export filetype to DXF ?
  • Automatically set the export filetype to Rhino7?
  • Export to a second (fixed) folder simultaneously.
    (So the first folder would be the regular folder, selected by the user in the pop-up screen, and the second would be a folder that never changes, somewhere on our server, to be accessed by the different cnc machines in our atelier)
import rhinoscriptsyntax as rs
import os


def ExportToCurrentFileFolder():

    working = rs.WorkingFolder()
    filePath = rs.DocumentPath()
    
    if not filePath:
        rs.MessageBox ("The current file has not been saved. Using Rhino's currenty working folder.")
        rs.Command('_Export')
        return

    name = os.path.splitext(filePath)

    nPath = os.path.normpath(name[0]) #parent folder
    
    rs.WorkingFolder( nPath)
    
    rs.Command('_Export')
    
    if rs.LastCommandResult() == 0:
        rs.ClipboardText(filePath)
        
    rs.WorkingFolder(working)
    
if __name__ == "__main__": ExportToCurrentFileFolder()

@Helvetosaur has multiple very useful export scripts floating somewhere in this forum…