Hello!
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; obj->Attributes().m_color; ON_wString uuidStr; ON_UuidToString(uuid, uuidStr); objBBox = objGeo->BoundingBox(); area = objBBox.Area(); vol = objBBox.Volume(); dimension = objGeo->Dimension(); obj->Select(true); selected_count++; 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) context.m_doc.Redraw(); 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!