/// <summary> /// Processes IfcObjectDefinition attributes. /// </summary> /// <param name="ifcObjectDefinition">The IfcObjectDefinition handle.</param> protected override void Process(IFCAnyHandle ifcObjectDefinition) { base.Process(ifcObjectDefinition); ShapeType = GetShapeType(ifcObjectDefinition); // If we aren't importing this category, skip processing. if (!IFCCategoryUtil.CanImport(EntityType, ShapeType)) { throw new InvalidOperationException("Don't Import"); } // Before IFC2x3, IfcTypeObject did not have IsDecomposedBy. HashSet <IFCAnyHandle> elemSet = null; if (IFCImportFile.TheFile.SchemaVersion >= IFCSchemaVersion.IFC2x3 || !IFCAnyHandleUtil.IsSubTypeOf(ifcObjectDefinition, IFCEntityType.IfcTypeObject)) { elemSet = IFCAnyHandleUtil.GetAggregateInstanceAttribute <HashSet <IFCAnyHandle> >(ifcObjectDefinition, "IsDecomposedBy"); } if (elemSet != null) { foreach (IFCAnyHandle elem in elemSet) { ProcessIFCRelDecomposes(elem); } } HashSet <IFCAnyHandle> hasAssociations = IFCAnyHandleUtil.GetAggregateInstanceAttribute <HashSet <IFCAnyHandle> >(ifcObjectDefinition, "HasAssociations"); if (hasAssociations != null) { foreach (IFCAnyHandle hasAssociation in hasAssociations) { if (IFCAnyHandleUtil.IsSubTypeOf(hasAssociation, IFCEntityType.IfcRelAssociatesMaterial)) { ProcessIFCRelAssociatesMaterial(hasAssociation); } else { IFCImportFile.TheLog.LogUnhandledSubTypeError(hasAssociation, IFCEntityType.IfcRelAssociates, false); } } } // The default IFC2x3_TC1.exp file does not have this INVERSE attribute correctly set. Encapsulate this function. ISet <IFCAnyHandle> hasAssignments = IFCImportHandleUtil.GetHasAssignments(ifcObjectDefinition); if (hasAssignments != null) { foreach (IFCAnyHandle hasAssignment in hasAssignments) { ProcessIFCRelAssigns(hasAssignment); } } IFCImportFile.TheLog.AddToElementCount(); }
/// <summary> /// Processes IfcObjectDefinition attributes. /// </summary> /// <param name="ifcObjectDefinition">The IfcObjectDefinition handle.</param> protected override void Process(IFCAnyHandle ifcObjectDefinition) { base.Process(ifcObjectDefinition); PredefinedType = GetPredefinedType(ifcObjectDefinition); // If we aren't importing this category, skip processing. if (!IFCCategoryUtil.CanImport(EntityType, PredefinedType)) { throw new InvalidOperationException("Don't Import"); } // Before IFC2x3, IfcTypeObject did not have IsDecomposedBy. HashSet <IFCAnyHandle> elemSet = null; if (IFCImportFile.TheFile.SchemaVersionAtLeast(IFCSchemaVersion.IFC2x3) || !IFCAnyHandleUtil.IsSubTypeOf(ifcObjectDefinition, IFCEntityType.IfcTypeObject)) { elemSet = IFCAnyHandleUtil.GetAggregateInstanceAttribute <HashSet <IFCAnyHandle> >(ifcObjectDefinition, "IsDecomposedBy"); } if (elemSet != null) { foreach (IFCAnyHandle elem in elemSet) { ProcessIFCRelDecomposes(elem); } } HashSet <IFCAnyHandle> hasAssociations = IFCAnyHandleUtil.GetAggregateInstanceAttribute <HashSet <IFCAnyHandle> >(ifcObjectDefinition, "HasAssociations"); if (hasAssociations != null) { foreach (IFCAnyHandle hasAssociation in hasAssociations) { if (IFCAnyHandleUtil.IsSubTypeOf(hasAssociation, IFCEntityType.IfcRelAssociatesMaterial)) { ProcessIFCRelAssociatesMaterial(hasAssociation); } else if (IFCAnyHandleUtil.IsSubTypeOf(hasAssociation, IFCEntityType.IfcRelAssociatesClassification)) { ProcessRelAssociatesClassification(hasAssociation); } else { Importer.TheLog.LogUnhandledSubTypeError(hasAssociation, IFCEntityType.IfcRelAssociates, false); } } } ISet <IFCAnyHandle> hasAssignments = IFCAnyHandleUtil.GetAggregateInstanceAttribute <HashSet <IFCAnyHandle> >(ifcObjectDefinition, "HasAssignments"); if (hasAssignments != null) { foreach (IFCAnyHandle hasAssignment in hasAssignments) { ProcessIFCRelAssigns(hasAssignment); } } Importer.TheLog.AddToElementCount(); }