How to get detailed information about the objects on the scene?


So, I am trying to get detailed information about all the objects on the scene. Everything from its transforms, to its vertices, UV coordinates, normals, materials with PBR properties and all that.

I have gone through the docs and the forum, and right now, I have code that is similar to this documentation about getting layer objects. So what I have now is:

CRhinoCommand::result CCommandGetObjectInfo::RunCommand(const CRhinoCommandContext& context)
	int selected_count = 0;
	const ON_Geometry* objGeo;
	const ON_Mesh* objMesh;
	ON_BoundingBox objBBox;
	int dimension = 0;
	double area = 0;
	double vol = 0;
	ON_UUID uuid;
	int objDisplayOrder = 0;
	const wchar_t* layer_name = L"Default";
	const int layer_index = context.m_doc.m_layer_table.FindLayerFromFullPathName(layer_name, ON_UNSET_INT_INDEX);
	if (layer_index != ON_UNSET_INT_INDEX)
		const CRhinoLayer& layer = context.m_doc.m_layer_table[layer_index];
		if (!layer.IsDeleted())
			ON_SimpleArray objects;
			const int object_count = context.m_doc.LookupObject(layer, objects);
			if (object_count > 0)
				for (int i = 0; i < object_count; i++)
					const CRhinoObject* obj = objects[i];
					if (nullptr != obj && obj->IsSelectable())
						objGeo = obj->Geometry();
						objDisplayOrder = obj->Attributes().m_display_order;
						uuid = obj->Attributes().m_uuid;
						ON_wString uuidStr;
						ON_UuidToString(uuid, uuidStr);
						objBBox = objGeo->BoundingBox();
						area = objBBox.Area();
						vol = objBBox.Volume();
						dimension = objGeo->Dimension();
						RhinoApp().Print(L"The object no. %d with Unique identifier %s is a %d dimension object and the area and vol of its bounding box are %lf and %lf. The display order of it is %d\n",  selected_count, uuidStr, dimension, area, vol, objDisplayOrder);

	if (selected_count > 0)

	RhinoApp().Print(L"Selected layer's total objects are = %d\n", selected_count);

	return CRhinoCommand::success;

So, now I would like to get the details of the object, as I mentioned earlier. How exactly do I do that? I have gone through the docs, but it seems confusing to me right now. Please let me know if I missed some documentation or API classes that can help me. Thank you!

Hi @binigya,

What is the purpose for getting all these details? Are there particular objects you are specifically interested in?

Getting objects by layer is one way of walking the document. Another way is to use a CRhinoObjectIterator class. The developer samples, found on GitHub, demonstrate its usage.

– Dale

Hello @dale,
My aim is to make an exporter plugin for an under-development 3D model viewer. So naturally, I would need to get my hands on any data there is possible to export the object data accurately.

Currently, I’m using the objectIterator class to iterate through the object and using the Attributes() method to get their details. I’m also using the Tables that Rhino stores to get data about Materials, Layers, etc.

So @dale, would this be the correct way to handle the task of exporting a Rhino model to another format?

Thank you!

P.S: If it is possible, could you please tell me how did the team at Rhino handle the task of exporting to another file format (say, 3DS) and what was their workflow? It would really give me some valuable pointers and guidelines to keep in mind.

In general, yes.

For a sample of a file export plug-in, see the SampleExportMesh plug-in source code in the developer samples repository on GitHub.

– Dale

Thank you @dale!