/// <summary> /// Processes IfcElement attributes. /// </summary> /// <param name="ifcElement">The IfcElement handle.</param> protected override void Process(IFCAnyHandle ifcElement) { base.Process(ifcElement); m_Tag = IFCAnyHandleUtil.GetStringAttribute(ifcElement, "Tag"); ICollection <IFCAnyHandle> hasOpenings = IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(ifcElement, "HasOpenings"); if (hasOpenings != null) { foreach (IFCAnyHandle hasOpening in hasOpenings) { IFCAnyHandle relatedOpeningElement = IFCAnyHandleUtil.GetInstanceAttribute(hasOpening, "RelatedOpeningElement"); if (IFCAnyHandleUtil.IsNullOrHasNoValue(relatedOpeningElement)) { continue; } IFCFeatureElementSubtraction opening = IFCFeatureElementSubtraction.ProcessIFCFeatureElementSubtraction(relatedOpeningElement); if (opening != null) { opening.VoidsElement = this; Openings.Add(opening); } } } // "HasPorts" is new to IFC2x2. // For IFC4, "HasPorts" has moved to IfcDistributionElement. We'll keep the check here, but we will only check it // if we are exporting before IFC4 or if we have an IfcDistributionElement handle. bool checkPorts = (IFCImportFile.TheFile.SchemaVersion > IFCSchemaVersion.IFC2x2) && (IFCImportFile.TheFile.SchemaVersion < IFCSchemaVersion.IFC4 || IFCAnyHandleUtil.IsSubTypeOf(ifcElement, IFCEntityType.IfcDistributionElement)); if (checkPorts) { ICollection <IFCAnyHandle> hasPorts = IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(ifcElement, "HasPorts"); if (hasPorts != null) { foreach (IFCAnyHandle hasPort in hasPorts) { IFCAnyHandle relatingPort = IFCAnyHandleUtil.GetInstanceAttribute(hasPort, "RelatingPort"); if (IFCAnyHandleUtil.IsNullOrHasNoValue(relatingPort)) { continue; } IFCPort port = IFCPort.ProcessIFCPort(relatingPort); if (port != null) { Ports.Add(port); } } } } }
/// <summary> /// Post-process IfcPort attributes. /// </summary> public override void PostProcess() { base.PostProcess(); // Force ContainedIn, ConnectedFrom and ConnectedTo to be created in the respective getters. IFCElement containedIn = ContainedIn; IFCPort connectedFrom = ConnectedFrom; IFCPort connectedTo = ConnectedTo; }
/// <summary> /// Processes IfcElement attributes. /// </summary> /// <param name="ifcElement">The IfcElement handle.</param> protected override void Process(IFCAnyHandle ifcElement) { base.Process(ifcElement); m_Tag = IFCAnyHandleUtil.GetStringAttribute(ifcElement, "Tag"); if (IFCImportFile.TheFile.SchemaVersionAtLeast(IFCSchemaVersion.IFC2x2) || IFCAnyHandleUtil.IsSubTypeOf(ifcElement, IFCEntityType.IfcBuildingElement)) { ProcessOpenings(ifcElement); } // "HasPorts" is new to IFC2x2. // For IFC4, "HasPorts" has moved to IfcDistributionElement. We'll keep the check here, but we will only check it // if we are exporting before IFC4 or if we have an IfcDistributionElement handle. bool checkPorts = (IFCImportFile.TheFile.SchemaVersionAtLeast(IFCSchemaVersion.IFC2x3)) && (!IFCImportFile.TheFile.SchemaVersionAtLeast(IFCSchemaVersion.IFC4Obsolete) || IFCAnyHandleUtil.IsSubTypeOf(ifcElement, IFCEntityType.IfcDistributionElement)); if (checkPorts) { ICollection <IFCAnyHandle> hasPorts = IFCAnyHandleUtil.GetValidAggregateInstanceAttribute <List <IFCAnyHandle> >(ifcElement, "HasPorts"); if (hasPorts != null) { foreach (IFCAnyHandle hasPort in hasPorts) { IFCAnyHandle relatingPort = IFCAnyHandleUtil.GetInstanceAttribute(hasPort, "RelatingPort"); if (IFCAnyHandleUtil.IsNullOrHasNoValue(relatingPort)) { continue; } IFCPort port = IFCPort.ProcessIFCPort(relatingPort); if (port != null) { Ports.Add(port); } } } } }