My Goal
I want to open any empty rhino document as part of a series of integration tests.
Where I get stuck
As it stands, I need to know if a Rhino Document needs saving or not so I can open an empty one. But I have no way to know if the current document needs to be saved or not. I could of course call doc.Save()
but I don’t want to save the document in this case as this adds unnecessary time to the tests and often I don’t want to save the modified file.
Condition if the file needs saving
RhinoApp.RunScript("-Open N <file>", true);
Condition if the file does not need saving
RhinoApp.RunScript("-Open <file>", true);
My ideal code
var templateDirectory = Rhino.ApplicationSettings.FileSettings.TemplateFolder;
var template = Directory.GetFiles(templateDirectory, "*.3dm").FirstOrDefault();
string NorNot = doc.NeedsToSave() ? "N" : "";
RhinoApp.RunScript($"-Open {NorNot} \"{template}\"", true);
– cs