Rhino Inside and Python

I am trying to duplicate the example rhino-inside Convert ConsoleApp written in C# into Python, but really having no luck.

Sorry if there’s an obvious solution, but the documentation does not seem to match up to reality when trying to use Python.

The C# app is creating a ‘RhinoCore’ but I have not been able to figure out how to get it within Python, nor how to ‘Create’ a RhinoDoc, since it seems to want some unspecified argument(s).

The example code is:

import rhinoinside
rhinoinside.load()
import System
import Rhino


fn = "c:\\drawing.stl"
cmd = "_import \"{0}\"".format(fn)
doc = Rhino.RhinoDoc.Create()
opts = Rhino.FileIO.FileObjReadOptions(Rhino.FileIO.FileReadOptions())
obj = Rhino.FileIO.FileObj.Read(cmd, doc, opts)

It fails on the Rhino.RhinoDoc.Create() wanting some unspecified argument, but the documentation does not show any. Not sure where to go next. Anybody have any ideas?

PS: the error message is:

PS C:\Users\krivacic\Rhino_Tests\Test1> python .\example.py
Traceback (most recent call last):
  File ".\example.py", line 10, in <module>
    doc = Rhino.RhinoDoc.Create()
TypeError: No method matches given arguments
1 Like

The Create function is looking to get a string as input though I’m not quite sure this is going to work yet with the current V7 WIP.

https://developer.rhino3d.com/api/RhinoCommon/html/M_Rhino_RhinoDoc_Create.htm

Thanks.

Is this the right way to create an off-screen document to draw into?

And where do I find the list of template names for the create?

2 Likes