This is the basic outline of what we’re proposing to change:
Doc
property somewhere in the Converters, and use that instead of the ActiveDoc
when calling SetContextDocument()
in the converter.
GetHeadlessDoc()
that will:
%appdata%/speckle/kits/objects/rhinoTemplate.3dm
)Rhino.CreateHeadlessDoc()
Doc
property from being null, either set or return the GetHeadlessDoc()
if the ActiveDoc
is null.Doc
for a custom one at runtime using a script in GH.For reference, this stems from conversations in the forum:
Not able to disable conversion on the Synchronous Sender
Running Speckle on Rhino Compute
We depend on the ActiveDoc
to be set as the Converter document using SetContextDocument
This seemed to be harmless until we started playing around with Rhino.Compute, which does not actually have an ActiveDoc
set.
There is also the fact that was raised on the forum about this new warning in the Rhino Docs: https://developer.rhino3d.com/api/RhinoCommon/html/P_Rhino_RhinoDoc_ActiveDoc.htm
WARNING!! Do not use the ActiveDoc if you don't have to.
Under Mac Rhino the ActiveDoc can change while a command is running.
Use the doc that is passed to you in your RunCommand function
or continue to use the same doc after the first call to ActiveDoc.
Chris welch did suggest one of my initial ideas, which is to write a wrapper class to hold all Converter settings, see: