private void RetrieveObjects(long ifcModel, string objectDisplayName) { long ifcObjectInstances = IfcEngine.x64.sdaiGetEntityExtentBN(ifcModel, objectDisplayName), noIfcObjectIntances = IfcEngine.x64.sdaiGetMemberCount(ifcObjectInstances); if (noIfcObjectIntances != 0) { IFCItemX64 NewItem = null; if (_rootIfcItem == null) { _rootIfcItem = new IFCItemX64(); _rootIfcItem.CreateItem(null, 0, "", objectDisplayName, "", ""); NewItem = _rootIfcItem; } else { IFCItemX64 LastItem = _rootIfcItem; while (LastItem != null) { if (LastItem.next == null) { LastItem.next = new IFCItemX64(); LastItem.next.CreateItem(null, 0, "", objectDisplayName, "", ""); NewItem = LastItem.next; break; } else { LastItem = LastItem.next; } } ; } for (int i = 0; i < noIfcObjectIntances; ++i) { NormalEntityProcessing(objectDisplayName, ifcObjectInstances, i, NewItem); } } }
private static void NormalEntityProcessing(string objectDisplayName, long ifcObjectInstances, int i, IFCItemX64 NewItem) { long ifcObjectIns = 0; IfcEngine.x64.engiGetAggrElement(ifcObjectInstances, i, IfcEngine.x64.sdaiINSTANCE, out ifcObjectIns); IntPtr value = IntPtr.Zero; IfcEngine.x64.sdaiGetAttrBN(ifcObjectIns, "GlobalId", IfcEngine.x64.sdaiSTRING, out value); string globalID = Marshal.PtrToStringAnsi((IntPtr)value); if (string.CompareOrdinal(objectDisplayName, "IfcSIUnit") == 0) { value = IntPtr.Zero; IfcEngine.x64.sdaiGetAttrBN(ifcObjectIns, "Prefix", IfcEngine.x64.sdaiSTRING, out value); string milInicator = Marshal.PtrToStringAnsi((IntPtr)value); if (string.CompareOrdinal(milInicator, ".MILLI.") == 0) { modelInMilimeters = true; } return; } value = IntPtr.Zero; IfcEngine.x64.sdaiGetAttrBN(ifcObjectIns, "Name", IfcEngine.x64.sdaiSTRING, out value); string name = Marshal.PtrToStringAnsi((IntPtr)value); value = IntPtr.Zero; IfcEngine.x64.sdaiGetAttrBN(ifcObjectIns, "Description", IfcEngine.x64.sdaiSTRING, out value); string description = Marshal.PtrToStringAnsi((IntPtr)value); IFCItemX64 subItem = new IFCItemX64(); subItem.CreateItem(NewItem, ifcObjectIns, objectDisplayName, globalID, name, description); }