private void ParseRhinoMeshes() { HashSet <RhinoObject> DocObjects = CollectExportedRhinoObjects(RhinoDocument, InstanceDefinitionHierarchyNodeDictionary.Values); // Make sure all render meshes are generated before attempting to export them. RhinoObject.GetRenderMeshes(DocObjects, /*okToCreate=*/ true, /*returnAllObjects*/ false); foreach (RhinoObject CurrentObject in DocObjects) { Mesh[] RenderMeshes = CurrentObject.GetMeshes(MeshType.Render); if (RenderMeshes != null && RenderMeshes.Length > 0) { List <Mesh> ExportedMeshes = new List <Mesh>(RenderMeshes); List <ObjectAttributes> MeshesAttributes = new List <ObjectAttributes>(RenderMeshes.Length); BrepObject CurrentBrep = (CurrentObject as BrepObject); if (CurrentBrep != null && CurrentBrep.HasSubobjectMaterials) { RhinoObject[] SubObjects = CurrentBrep.GetSubObjects(); for (int SubObjectIndex = 0; SubObjectIndex < SubObjects.Length; ++SubObjectIndex) { MeshesAttributes.Add(SubObjects[SubObjectIndex].Attributes); } } else { for (int RenderMeshIndex = 0; RenderMeshIndex < RenderMeshes.Length; ++RenderMeshIndex) { MeshesAttributes.Add(CurrentObject.Attributes); } } DatasmithMeshInfo MeshInfo = GenerateMeshInfo(CurrentObject.Id, ExportedMeshes, MeshesAttributes); if (MeshInfo != null) { ObjectIdToMeshInfoDictionary[CurrentObject.Id] = MeshInfo; } } } }