We need to set the units of the Rhino inside document in our AutoCAD application. Using the following for debug builds works fine:
var style = WindowStyle.Normal;
_rhinoCore ??= new RhinoCore(new[] { $"/scheme={schemeName}" }), style);
var rhinoDoc = RhinoDoc.ActiveDoc;
rhinoDoc.ModelUnitSystem = this.GetRhinoUnitSystem(internalUnits);
However, for release builds we don't need the UI, so a headless version is required. However:
It doesn't create a document,
It's therefore not possible to set the units, and
What document exactly are we using?
If we create a headless document, the application becomes unstable and inadvertently crashes AutoCAD without warning. No breakpoints hit either, its fatal.
var style = WindowStyle.NoWindow;
_rhinoCore ??= new RhinoCore(new[] { $"/scheme={schemeName}" }), style);
var rhinoDoc = RhinoDoc.CreateHeadless("...a mm template file");
rhinoDoc.ModelUnitSystem = this.GetRhinoUnitSystem(internalUnits);
We've checked the validity of the RhinoDoc.ActiveDoc straight after creating the headless doc and its valid and its units are successfully set. var style = WindowStyle.Hidden has also been tested and it seems to be stable, however it always displays the splash screen which we don't want. Rhino.UI.Dialogs.KillSplash() doesn't seem to work.
We need to set the units of the Rhino inside document in our AutoCAD application. Using the following for debug builds works fine:
However, for release builds we don't need the UI, so a headless version is required. However:
We've checked the validity of the RhinoDoc.ActiveDoc straight after creating the headless doc and its valid and its units are successfully set.
var style = WindowStyle.Hidden
has also been tested and it seems to be stable, however it always displays the splash screen which we don't want.Rhino.UI.Dialogs.KillSplash()
doesn't seem to work.What is the correct procedure?