Scripting New Document Not Headless

I’ve found that scripting -New in Rhino doesn’t seem to work headlessly as I would expect.

If the document is not modified, the below works great!

RhinoApp.RunScript($"-New N", true);

If the document has been modified, the below happens;

RhinoApp.RunScript($"-New", true);

image

Is there a workaround to this I can use code for. My goal is to open a new document with any template or no template

– cs

You need to set the document modified flag to false.

C#

Rhino.RhinoDoc.ActiveDoc.Modified = false;

Python:

rs.DocumentModified(False)
1 Like

I see there is RhinoDoc.Create but this requires a click of “Do not Save”.

– cs

IT HAS A SETTER? Ok I’ll try this, thanks @Mahdiyar

@dale would it be possible to make -New work headlessly even with modified Documents?