How do I get the scene reference in Rhino?

Hi, I need to get the scene definition for a 3DM file, that contains the data about the objects, meshes and other information of the current open file. How do I do so?

Hi @binigya,

All information that is stored in a 3dm file is located on a document object, or CRhinoDoc.

From a command, you can get the document as follows:

CRhinoCommand::result CCommandTest::RunCommand(const CRhinoCommandContext& context)
{
  CRhinoDoc& doc = context.m_doc;

  // todo...

  return CRhinoCommand::success;
}

Does this help?

– Dale

1 Like

Hey @dale,
Yes, it does help, thank you!
I also have another question. You see, I was using the Asset Importer framework earlier, and there is a “root node” in the structure of the 3d model file. The root node contains all the objects in the 3d file, as its children nodes. So is the CRhinoDoc the same as this root node?
Or, does Rhino not follow this type of organization at all?
I also mean to ask, are the objects and their sub-objects(if any) are organized as parent-children structures or not?

Hi @binigya,

Rhino doesn’t store stuff in a hierarchical manner. So I’m not sure this is a good analogy.

– Dale

1 Like

Hello @dale,
So if Rhino does not store its data in a hierarchical model.
Then, could you please tell me in what way does it store its data? It is now clear to me that the document holds data of the objects and the objects have their attributes and geometry. But I am still not fully transparent as to how the materials, meshes, etc are stored.
In short, what I want to say is could you show me a similar diagram like this:

, which can give me a bird’s eye on the rhino document organization? (This is the picture of a composition of a fbx file).
And as always, thank you for your reply and your time :slight_smile:

Hi @binigya,

In the document, Rhino objects are stored in a linked list. Other data, such as Layers, Material, Groups, etc., are stored in linear tables. Rhino’s object attributes references items in these tables.

– Dale

1 Like