Export Selected path

Is there a way to create a script to Export Selected to AI (or whatever common extension) using the current (or user inputted) filename to the current file path.

I do a lot of laser cutting and 3D printing and I always export the transport file to the current customer/date directory for historical purposed. OK, I’m lazy - I will rather write a script once to set this up to the path and default file name than have to go through my deep directory structure.

Hi,

Are you familiar with running scripts?
I had time to write this quick example:

import rhinoscriptsyntax as rs
import os


def export_here():
        
    extension = '.ai'
    
    #get objects to export
    ids = rs.GetObjects('Objects to export',preselect=True)
    if not ids: return
    
    #rhino document name
    docname = rs.DocumentName()[:-4]
    
    export_name = rs.StringBox('filename (excluding extension {})'.format(extension), docname)
    if not export_name: return
    
    export_path = os.path.join(rs.DocumentPath(), export_name+extension)
    
    rs.UnselectAllObjects()
    rs.SelectObjects(ids)
    rs.Command('_-Export "{}" _EnterEnd'.format(export_path))
    
export_here()

Does that work for you?
_Willem

I will play with it. I am concerned about the export options for the specific export type though.

I discovered the “Set Working Folder” command that does a bit of what I need so I use that in the mean time.

1 Like