How does RhinoDoc interact with the AppDomain when used inside AutoCAD?

If we launch Rhino Inside AutoCAD, is the RhinoDoc connected to the AppDomain of the AutoCAD application (A)?

So if the user were to open another AutoCAD application (B) - not another DWG/document in the same application - then the static call to RhinoDoc.ActiveDoc would return a new RhinoDoc instance within app domain B?

Similarly, if the user were to open the Rhino application separately, RhinoDoc.ActiveDoc app domain is the Rhino application itself, so it wouldn’t return the RhinoDoc created within app domain A or B?

cc @kike

Assuming the RhinoDoc is attached to the AppDomain, does this therefore mean if we call RhinoDoc.ActiveDoc within the AutoCAD context, its guaranteed to return the Document instance attached to/running ‘inside’ AutoCAD?

There is one RhinoDoc.ActiveDoc per running instance of an executable. Rhino.exe is a different top level application than Autocad.exe, so in this case there will be two different ActiveDoc instances when both applications are running.

It’s really the same as if you have two copies of rhino.exe running. In this case there would be two unique and different instances of RhinoDoc.ActiveDoc.

RhinoCommon does not fool around with any AppDomain shenanigans. We run everything in the main appdomain.

1 Like