protected override void Process(IFCAnyHandle ifcMaterial) { base.Process(ifcMaterial); Name = IFCImportHandleUtil.GetRequiredStringAttribute(ifcMaterial, "Name", true); List <IFCAnyHandle> hasRepresentation = null; if (IFCImportFile.TheFile.SchemaVersion >= IFCSchemaVersion.IFC2x3) { hasRepresentation = IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(ifcMaterial, "HasRepresentation"); } if (hasRepresentation != null && hasRepresentation.Count == 1) { if (!IFCAnyHandleUtil.IsSubTypeOf(hasRepresentation[0], IFCEntityType.IfcMaterialDefinitionRepresentation)) { Importer.TheLog.LogUnexpectedTypeError(hasRepresentation[0], IFCEntityType.IfcMaterialDefinitionRepresentation, false); } else { MaterialDefinitionRepresentation = IFCProductRepresentation.ProcessIFCProductRepresentation(hasRepresentation[0]); } } Importer.TheLog.AddToElementCount(); }
/// <summary> /// Get the curve from the Axis representation of the given IfcProduct, transformed to the current local coordinate system. /// </summary> /// <param name="creator">The IfcProduct that may or may not contain a valid axis curve.</param> /// <param name="lcs">The local coordinate system.</param> /// <returns>The axis curve, if found, and valid.</returns> /// <remarks>In this case, we only allow bounded curves to be valid axis curves. /// The Curve may be contained as either a single Curve in the IFCCurve representation item, /// or it could be an open CurveLoop that could be represented as a single curve.</remarks> private Curve GetAxisCurve(IFCProduct creator, Transform lcs) { // We need an axis curve to clip the extrusion profiles; if we can't get one, fail IFCProductRepresentation productRepresentation = creator.ProductRepresentation; if (productRepresentation == null) { return(null); } IList <IFCRepresentation> representations = productRepresentation.Representations; if (representations == null) { return(null); } foreach (IFCRepresentation representation in representations) { // Go through the list of representations for this product, to find the Axis representation. if (representation == null || representation.Identifier != IFCRepresentationIdentifier.Axis) { continue; } IList <IFCRepresentationItem> items = representation.RepresentationItems; if (items == null) { continue; } // Go through the list of representation items in the Axis representation, to look for the IfcCurve. foreach (IFCRepresentationItem item in items) { if (item is IFCCurve) { // We will accept a bounded curve, or an open CurveLoop that can be represented // as one curve. IFCCurve ifcCurve = item as IFCCurve; Curve axisCurve = ifcCurve.Curve; if (axisCurve == null) { axisCurve = ifcCurve.ConvertCurveLoopIntoSingleCurve(); } if (axisCurve != null) { return(axisCurve.CreateTransformed(lcs)); } } } } return(null); }
/// <summary> /// Cleans out the IFCEntity to save memory. /// </summary> public override void CleanEntity() { base.CleanEntity(); ObjectLocation = null; m_ProductRepresentation = null; m_Solids = null; m_Voids = null; }
/// <summary> /// Processes IfcProduct attributes. /// </summary> /// <param name="ifcProduct">The IfcProduct handle.</param> protected override void Process(IFCAnyHandle ifcProduct) { base.Process(ifcProduct); ProcessObjectPlacement(ifcProduct); IFCAnyHandle ifcProductRepresentation = IFCImportHandleUtil.GetOptionalInstanceAttribute(ifcProduct, "Representation"); if (!IFCAnyHandleUtil.IsNullOrHasNoValue(ifcProductRepresentation)) { ProductRepresentation = IFCProductRepresentation.ProcessIFCProductRepresentation(ifcProductRepresentation); } }
/// <summary> /// Processes IfcProduct attributes. /// </summary> /// <param name="ifcProduct">The IfcProduct handle.</param> protected override void Process(IFCAnyHandle ifcProduct) { // We are going to process the IfcObjectPlacement before we do the base Process call. The reason for this is that we'd like to // process the IfcSite object placement before any of its children, so that the RelativeToSite can be properly set. // If this becomes an issue, we can instead move this to after the base.Process, and calculate RelativeToSite as a post-process step. ProcessObjectPlacement(ifcProduct); base.Process(ifcProduct); IFCAnyHandle ifcProductRepresentation = IFCImportHandleUtil.GetOptionalInstanceAttribute(ifcProduct, "Representation"); if (!IFCAnyHandleUtil.IsNullOrHasNoValue(ifcProductRepresentation)) { ProductRepresentation = IFCProductRepresentation.ProcessIFCProductRepresentation(ifcProductRepresentation); } }
/// <summary> /// Get the curve from the Axis representation of the given IfcProduct, transformed to the current local coordinate system. /// </summary> /// <param name="creator">The IfcProduct that may or may not contain a valid axis curve.</param> /// <param name="lcs">The local coordinate system.</param> /// <returns>The axis curve, if found, and valid.</returns> /// <remarks>In this case, we only allow bounded lines and arcs to be valid axis curves, as per IFC2x3 convention. /// The Curve may be contained as either a single Curve in the IFCCurve representation item, or it could be an /// open CurveLoop with one item.</remarks> private Curve GetAxisCurve(IFCProduct creator, Transform lcs) { // We need an axis curve to clip the extrusion profiles; if we can't get one, fail IFCProductRepresentation productRepresentation = creator.ProductRepresentation; if (productRepresentation == null) { return(null); } IList <IFCRepresentation> representations = productRepresentation.Representations; if (representations == null) { return(null); } foreach (IFCRepresentation representation in representations) { // Go through the list of representations for this product, to find the Axis representation. if (representation == null || representation.Identifier != IFCRepresentationIdentifier.Axis) { continue; } IList <IFCRepresentationItem> items = representation.RepresentationItems; if (items == null) { continue; } // Go through the list of representation items in the Axis representation, to look for the IfcCurve. foreach (IFCRepresentationItem item in items) { if (item is IFCCurve) { // We will accept either a bounded Curve of type Line or Arc, // or an open CurveLoop with one curve that satisfies the same condition. IFCCurve ifcCurve = item as IFCCurve; Curve axisCurve = ifcCurve.Curve; if (axisCurve == null) { CurveLoop axisCurveLoop = ifcCurve.CurveLoop; if (axisCurveLoop != null && axisCurveLoop.IsOpen() && axisCurveLoop.Count() == 1) { axisCurve = axisCurveLoop.First(); if (!(axisCurve is Line || axisCurve is Arc)) { axisCurve = null; } } } if (axisCurve != null) { return(axisCurve.CreateTransformed(lcs)); } } } } return(null); }
protected override void Process(IFCAnyHandle ifcMaterial) { base.Process(ifcMaterial); Name = IFCImportHandleUtil.GetRequiredStringAttribute(ifcMaterial, "Name", true); List<IFCAnyHandle> hasRepresentation = null; if (IFCImportFile.TheFile.SchemaVersion >= IFCSchemaVersion.IFC2x3) hasRepresentation = IFCAnyHandleUtil.GetAggregateInstanceAttribute<List<IFCAnyHandle>>(ifcMaterial, "HasRepresentation"); if (hasRepresentation != null && hasRepresentation.Count == 1) { if (!IFCAnyHandleUtil.IsSubTypeOf(hasRepresentation[0], IFCEntityType.IfcMaterialDefinitionRepresentation)) Importer.TheLog.LogUnexpectedTypeError(hasRepresentation[0], IFCEntityType.IfcMaterialDefinitionRepresentation, false); else MaterialDefinitionRepresentation = IFCProductRepresentation.ProcessIFCProductRepresentation(hasRepresentation[0]); } Importer.TheLog.AddToElementCount(); }