private List <IntPtr> findElements(List <IntPtr> listPropSets) { var objectList = new List <IntPtr>(); foreach (IntPtr iPropertySetInstance in listPropSets) { // find element that contains the propertySet if (iPropertySetInstance != IntPtr.Zero) { IntPtr iEntityCount; IntPtr relDefProperties = getAggregator("ifcRelDefinesByProperties", out iEntityCount); foreach (IntPtr iRelDefPropInstance in findEntity(relDefProperties, iEntityCount)) { IntPtr propertySetDef; _ifcEngine.GetAttribute(iRelDefPropInstance, "RelatingPropertyDefinition", IfcEngine.SdaiType.Instance, out propertySetDef); if (propertySetDef.Equals(iPropertySetInstance)) { IntPtr objectInstances; _ifcEngine.GetAttribute(iRelDefPropInstance, "RelatedObjects", IfcEngine.SdaiType.Aggregation, out objectInstances); var iObjectCount = _ifcEngine.GetMemberCount(objectInstances); foreach (IntPtr iObjectInstance in findEntity(objectInstances, iObjectCount)) { objectList.Add(iObjectInstance); } } } } } return(objectList); }
// find propertySet that contains the property private List <IntPtr> findPropertySets(IntPtr iPropertyInstance) { var listPropSetInst = new List <IntPtr>(); if (iPropertyInstance != IntPtr.Zero) { IntPtr iPropertySetsCount; IntPtr propertySets = getAggregator("ifcPropertySet", out iPropertySetsCount); foreach (IntPtr iPropertySetInstance in findEntity(propertySets, iPropertySetsCount)) { IntPtr propertiesInstance; _ifcEngine.GetAttribute(iPropertySetInstance, "HasProperties", IfcEngine.SdaiType.Aggregation, out propertiesInstance); if (propertiesInstance != IntPtr.Zero) { var iPropertiesCount = _ifcEngine.GetMemberCount(propertiesInstance); foreach (IntPtr iPropertyInst in findEntity(propertiesInstance, iPropertiesCount)) { if (iPropertyInst.Equals(iPropertyInstance)) { listPropSetInst.Add(iPropertySetInstance); } } } } } return(listPropSetInst); }
private void RetrieveObjects(IntPtr ifcModel, string sObjectSPFFName, string ObjectDisplayName) { IntPtr ifcObjectInstances = _ifcEngine.GetEntityExtent(ifcModel, ObjectDisplayName), noIfcObjectIntances = _ifcEngine.GetMemberCount(ifcObjectInstances); if (noIfcObjectIntances != IntPtr.Zero) { IFCItem NewItem = null; if (_rootIfcItem == null) { _rootIfcItem = new IFCItem(); _rootIfcItem.CreateItem(null, IntPtr.Zero, "", ObjectDisplayName, "", ""); NewItem = _rootIfcItem; } else { IFCItem LastItem = _rootIfcItem; while (LastItem != null) { if (LastItem.next == null) { LastItem.next = new IFCItem(); LastItem.next.CreateItem(null, IntPtr.Zero, "", ObjectDisplayName, "", ""); NewItem = LastItem.next; break; } else { LastItem = LastItem.next; } } ; } for (int i = 0; i < noIfcObjectIntances.ToInt32(); ++i) { IntPtr ifcObjectIns = IntPtr.Zero; _ifcEngine.GetAggregationElement(ifcObjectInstances, i, IfcEngine.SdaiType.Instance, out ifcObjectIns); IntPtr value = IntPtr.Zero; _ifcEngine.GetAttribute(ifcObjectIns, "GlobalId", IfcEngine.SdaiType.Unicode, out value); string globalID = Marshal.PtrToStringUni((IntPtr)value); value = IntPtr.Zero; _ifcEngine.GetAttribute(ifcObjectIns, "Name", IfcEngine.SdaiType.Unicode, out value); string name = Marshal.PtrToStringUni((IntPtr)value); value = IntPtr.Zero; _ifcEngine.GetAttribute(ifcObjectIns, "Description", IfcEngine.SdaiType.Unicode, out value); string description = Marshal.PtrToStringUni((IntPtr)value); IFCItem subItem = new IFCItem(); subItem.CreateItem(NewItem, ifcObjectIns, ObjectDisplayName, globalID, name, description); } } }
private void CreateProjectTreeItems() { var iEntityID = IFCEngine.GetEntityExtent(IfcModel, "IfcProject"); var iEntitiesCount = IFCEngine.GetMemberCount(iEntityID); for (int iEntity = 0; iEntity < iEntitiesCount.ToInt32(); iEntity++) { IFCEngine.GetAggregationElement(iEntityID, iEntity, IfcEngine.SdaiType.Instance, out IntPtr iInstance); IFCTreeItem ifcTreeItem = new IFCTreeItem(); ifcTreeItem.instance = iInstance; CreateTreeItem(null, ifcTreeItem); AddChildrenTreeItems(ifcTreeItem, iInstance, "IfcSite"); } }