How to create a new RhinoDoc

When creating a rhino python script within rhino python editor I have access to the active rhino document at all time. On the other hand, when I import RhinoCommon to CPython using rhinoinside, as a default I do not have a rhino document available. My question is, how do I create one?

Hi,

I’m not all that familiar with reading and writing 3dm’s but you can create and load a 3dm through https://developer.rhino3d.com/api/RhinoCommon/html/T_Rhino_FileIO_File3dm.htm

Where you probablt best use a template.3dm to open, but maybe you can create one on the fly. Someone else can probably inform you better on that.

-Willem

Thank you. I would prefer to load a rhino doc without actually load or save to a 3dm. I might be a bit confused with the whole doc concept, but I thought that a Doc object could exist without being associated with a file object.

Pål

@pgs if what you want is to create a new headless doc using Rhino.Inside, this will do the trick:

doc = Rhino.RhinoDoc.New(None)

https://developer.rhino3d.com/wip/api/RhinoCommon/html/M_Rhino_RhinoDoc_New.htm

Thank you, it works perfectly!

This link is broken.

Hi @umcadop,

In Rhino 7, use RhinoDoc.CreateHeadless.

– Dale