Importing STP files, Rhinocommon

I have a short about automatically importing STP files (and saving them as Rhino files).

First “pre-question” is, when creating a new RhinoDoc, I need these template names, is there a list of those strings somewhere?

RhinoDoc newDoc = RhinoDoc.Create(“Large Objects - Meters”);

And the question is, once I use:

if (newDoc.Import(file))

I get this STP import options prompt in Rhino:

Is there a way to supress that? Because If I import 100 files I have to click Enter 100 times.

P.S. An advice if I should do it with RhinoDoc.Create or maybe CreateHeadless or maybe with File3dm is also welcome. Imagine a simple automated conversion tool, that goes through STP files, imports one by one and saves each one of them as 3DM.


Check Tools > Options > Files > Template Files.

How about something like this?

import Eto
import Rhino
import System
import scriptcontext as sc

def __browse_for_folder():
    dlg = Eto.Forms.SelectFolderDialog()
    dlg.Directory = Rhino.ApplicationSettings.FileSettings.WorkingFolder
    if dlg.ShowDialog(None) == Eto.Forms.DialogResult.Ok:
        return dlg.Directory
    return None

def test_convert_step():
    folder = __browse_for_folder()
    if folder:
        files = System.IO.Directory.GetFiles(folder, '*.stp')
        for in_file in files:
            sc.doc.Modified = False
            script = '_-Open \"{0}\" _Enter'.format(in_file)
            Rhino.RhinoApp.RunScript(script, False)
            out_file = System.IO.Path.ChangeExtension(in_file, ".3dm")
            script = '_-Save \"{0}\"'.format(out_file)
            Rhino.RhinoApp.RunScript(script, False)
        sc.doc.Modified = False
        script = '_-New _None'
        Rhino.RhinoApp.RunScript(script, False)

if __name__ == "__main__":

– Dale