Using Rhino.RhinoDoc.Import

Just trying to use Rhino.RhinoDoc.Import but I cant seem to obtain the active document. How do I target the active document I am working in ? I tried scriptcontext.doc.ActiveDoc(), Rhino.RhinoDoc.ActiveDoc(), and other similar combos but I keep getting RhinoDoc is not callable. I guess I am missing something conceptually. Could anyone clear it up ?

Thanks !

RhinoDoc.Import Method is not a static class method, but an instance method. Furthermore RhinoDoc.ActiveDoc Property is a property, not a method:

import scriptcontext

doc = sc.doc # this is already the active doc

Thanks Nathan

Sorry for the basic question, I had to step away from scripting for some time. Just getting back into the swing of things.

Thanks !

@nathanletwory When using the input method, the command line kicks in asking for user input for import parameters. Is there a way to just hit enter ? Or can I specify the parameters within the script so it does not show ? I tried NoEcho, CommandEnd, and other similar arrangements with the rs.command() method.

You might be best off scripting the _import command, see for instance

I have same work, this is my code, I hope this helps you:

import Rhino
import scriptcontext as sc

Read_options = Rhino.FileIO.FileReadOptions()
Read_options.BatchMode = True
Read_options.ImportMode = True
sc.doc.ReadFile(path, Read_options)
1 Like