RhinoDoc vs DocObjects

Hi,

Could someone explain what is the difference between RhinoDoc and DocObjects? I understand by reading rhinocommon that RhinoDoc is a class under Rhino namespace, and DocObjects is another namespace(Rhino.DocObjects), but it sounds like to me they are basically dealing with same things. For example, i can do pretty much the same things with those two as below.

var obj1 = Rhino.RhinoDoc.ActiveDoc.Objects.FindId(id);
Rhino.DocObjects.ObjRef oRef = new Rhino.DocObjects.ObjRef(obj1);
Curve crv1 = oRef.Curve();

var obj2 = new Rhino.DocObjects.ObjRef(id);
Curve crv2 = obj2.Curve();

A = crv1;
B = crv2;

The only difference that i see between the two is the additional code in the 2nd line, I am speculating RhinoDoc only retrieve information of geometries on the active rhino file, and DocObjects brings in geometries in the active rhino file by referencing - I am not even sure if I am describing it properly - I am just an architect! :slight_smile:

I wish i could find a good documentation or book to better understand the fundamentals in rhinocommon… Any comments, suggestions will be much appreciated. Thanks in advance.

Best,
W

1 Like

ActiveDoc indicate that it may change during a execution. The documentation says:

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.

https://developer.rhino3d.com/api/RhinoCommon/html/P_Rhino_RhinoDoc_ActiveDoc.htm

// Rolf

Hi @woojsung,

RhinoDoc (e.g. document) is the class that all things written to a 3dm file are stored in.

DocObjects (e.g document objects) are the things stored in a Rhino document.

Often, there are several ways to do something. In this case, the constructor for ObjRef takes either a RhinoObject or the id of a RhinoObject.

– Dale

3 Likes

Dale and RIL, thank you so much for the info.