Closed ThomasMahon closed 1 year ago
I'm assuming licence allocation occurs when the Rhino core is initialized?
That is correct
@sbaer Thanks. I have two other related questions:
Dispose is really only meant to be called during shutdown. Once Rhino is loaded into the process, a licence is allocated and cannot be deallocated until the process is shut down.
@sbaer thanks for the info.
I have one other issue - how can I set the units of the Rhino doc without launching the application?
For example, for debug builds we want to launch the Rhino app UI. This works fine when we set the units to mm.
However for release versions we do not want the UI app, we just need Rhino running in the background, which means the ActiveDoc is null so the following code throws an exception. Its really important we can set the units. How can we do this for release builds using headless rhino?
var schemeName =
$"Inside-{HostApplicationServices.Current.Product}-{HostApplicationServices.Current.releaseMarketVersion}";
#if DEBUG
var style = WindowStyle.Normal;
_rhinoCore ??= new RhinoCore(new[] { $"/scheme={schemeName}" }); //, style);
#endif
#if !(DEBUG)
_rhinoCore ??= new RhinoCore(new[] { $"/scheme={schemeName}" });
#endif
var rhinoDoc = RhinoDoc.ActiveDoc;
rhinoDoc.ModelUnitSystem = this.GetRhinoUnitSystem(internalUnits);
@ThomasMahon you should be able to create a headless doc and set it as the ActiveDoc.
How are license's allocated using Rhino Inside AutoCAD? In the boilerplate provided in this repo I'm assuming licence allocation occurs when the Rhino core is initialized?
m_rhino_core = new RhinoCore(new[] { $"/scheme={schemeName}" }, style);