Export Script

(Gabriele Di Trapani) #1

Hi all,

I am new in programming and I would like to make this procedure automatic.
My goal is to write a script to export a group of surfaces (in iges) with their layer names and colour.
Do anyone have any suggestion please?



Hi Gabriele,

Can you elaborate a little or maybe send an example file and desired output.

My interpretation:
you want to select some surfaces and export as iges, but what I do not understand:

  • should each surface be a single iges?
  • what will the filename be?

I have a script setup that could help you get started, but if you let me know exactly what you want, I can set it up already to make it work the way you want


(Gabriele Di Trapani) #3


Hi Willem,

sorry but I didn’t recive any alert about your answer.
I would like to have a script to export the surfaces contained inside the rhino file into a single generic iges.
I will define the filename in the futere it is not a big issue at the moment.
If it is possible I would like to call this script in batch.
Please find attached a file testcube-export.3dm (37.2 KB)

Please let me known if I can use your script as starting point and I will try to implement it with my necessity.



Hi Gabriele,

The script below allows you to set an export folder and export the selected objects as iges
Does this help?

import rhinoscriptsyntax as rs

def export_iges(file_name,object_ids,EXPORTPATH):
    FILEPATH = EXPORTPATH +'\\'+ file_name + '.igs'

    #export with default scheme
    rs.Command('_-Export "{}" Default _Enter'.format(FILEPATH),echo=True)

def export_selected_as_iges():
    #get folder to save iges to
    EXPORTPATH = rs.BrowseForFolder( message ='select iges folder')
    if not EXPORTPATH : return
    # ask user to select (poly)surfaces for export
    object_ids = rs.GetObjects('Select (poly)surfaces to export as iges',filter = 8+16)
    if not object_ids : return 

    file_name = 'my_name'


(Gabriele Di Trapani) #5


Hi Willem,
It is working quite well, thank you.
I will try to customise the script on my necessity but I will let you know if I have any doubt.

Thanks again