protected override void Process(IFCAnyHandle ifcPolygonalFaceSet) { base.Process(ifcPolygonalFaceSet); bool?closed = IFCAnyHandleUtil.GetBooleanAttribute(ifcPolygonalFaceSet, "Closed"); if (closed != null) { Closed = closed; } IList <IFCAnyHandle> facesHnds = IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(ifcPolygonalFaceSet, "Faces"); if (facesHnds != null) { if (facesHnds.Count > 0) { Faces = new List <IFCIndexedPolygonalFace>(); } foreach (IFCAnyHandle facesHnd in facesHnds) { Faces.Add(IFCIndexedPolygonalFace.ProcessIFCIndexedPolygonalFace(facesHnd)); } } }
/// <summary> /// Process IfcTriangulatedFaceSet instance /// </summary> /// <param name="ifcTriangulatedFaceSet">the handle</param> protected override void Process(IFCAnyHandle ifcTriangulatedFaceSet) { base.Process(ifcTriangulatedFaceSet); IList <IList <double> > normals = IFCImportHandleUtil.GetListOfListOfDoubleAttribute(ifcTriangulatedFaceSet, "Normals"); if (normals != null) { if (normals.Count > 0) { Normals = normals; } } bool?closed = IFCAnyHandleUtil.GetBooleanAttribute(ifcTriangulatedFaceSet, "Closed"); if (closed != null) { Closed = closed; } IList <IList <int> > coordIndex = IFCImportHandleUtil.GetListOfListOfIntegerAttribute(ifcTriangulatedFaceSet, "CoordIndex"); if (coordIndex != null) { if (coordIndex.Count > 0) { CoordIndex = coordIndex; } } // Note that obsolete IFC4 files had a "NormalIndex". // We ignore this because we can't actually distinguish between these files. // "PnIndex" is new to IFC4Add2, so we'll protect here in case we see an obsolete file. try { if (IFCImportFile.TheFile.SchemaVersionAtLeast(IFCSchemaVersion.IFC4)) { IList <int> pnIndex = IFCAnyHandleUtil.GetAggregateIntAttribute <List <int> >(ifcTriangulatedFaceSet, "PnIndex"); if (pnIndex != null) { if (pnIndex.Count > 0) { PnIndex = pnIndex; } } } } catch (Exception ex) { if (IFCImportFile.HasUndefinedAttribute(ex)) { IFCImportFile.TheFile.DowngradeIFC4SchemaTo(IFCSchemaVersion.IFC4Add1Obsolete); } else { throw ex; } } }
/// <summary> /// Process IfcTriangulatedFaceSet instance /// </summary> /// <param name="ifcTriangulatedFaceSet">the handle</param> protected override void Process(IFCAnyHandle ifcTriangulatedFaceSet) { base.Process(ifcTriangulatedFaceSet); // Process the IFCCartesianPointLIst3D IFCAnyHandle coordinates = IFCImportHandleUtil.GetRequiredInstanceAttribute(ifcTriangulatedFaceSet, "Coordinates", true); if (IFCAnyHandleUtil.IsSubTypeOf(coordinates, IFCEntityType.IfcCartesianPointList3D)) { IFCCartesianPointList3D coordList = IFCCartesianPointList3D.processIFCCartesianPointList3D(coordinates); if (coordList != null) { Coordinates = coordList; } } IList <IList <double> > normals = IFCImportHandleUtil.GetListOfListOfDoubleAttribute(ifcTriangulatedFaceSet, "Normals"); if (normals != null) { if (normals.Count > 0) { Normals = normals; } } bool?closed = IFCAnyHandleUtil.GetBooleanAttribute(ifcTriangulatedFaceSet, "Closed"); if (closed != null) { Closed = closed; } IList <IList <int> > coordIndex = IFCImportHandleUtil.GetListOfListOfIntegerAttribute(ifcTriangulatedFaceSet, "CoordIndex"); if (coordIndex != null) { if (coordIndex.Count > 0) { CoordIndex = coordIndex; } } IList <IList <int> > normalIndex = IFCImportHandleUtil.GetListOfListOfIntegerAttribute(ifcTriangulatedFaceSet, "NormalIndex"); if (normalIndex != null) { if (normalIndex.Count > 0) { NormalIndex = normalIndex; } } }
/// <summary> /// Get a required boolean attribute from an entity. /// </summary> /// <param name="handle">The entity handle.</param> /// <param name="name">The attribute name.</param> /// <returns>The attribute value.</returns> static public bool GetRequiredBooleanAttribute(IFCAnyHandle handle, string name, out bool found) { bool?attribute = IFCAnyHandleUtil.GetBooleanAttribute(handle, name); if (!attribute.HasValue) { Importer.TheLog.LogMissingRequiredAttributeError(handle, name, false); found = false; return(false); } found = true; return(attribute.Value); }
/// <summary> /// Process IfcTriangulatedFaceSet instance /// </summary> /// <param name="ifcTriangulatedFaceSet">the handle</param> protected override void Process(IFCAnyHandle ifcTriangulatedFaceSet) { base.Process(ifcTriangulatedFaceSet); IList <IList <double> > normals = IFCImportHandleUtil.GetListOfListOfDoubleAttribute(ifcTriangulatedFaceSet, "Normals"); if (normals != null) { if (normals.Count > 0) { Normals = normals; } } bool?closed = IFCAnyHandleUtil.GetBooleanAttribute(ifcTriangulatedFaceSet, "Closed"); if (closed != null) { Closed = closed; } IList <IList <int> > coordIndex = IFCImportHandleUtil.GetListOfListOfIntegerAttribute(ifcTriangulatedFaceSet, "CoordIndex"); if (coordIndex != null) { if (coordIndex.Count > 0) { CoordIndex = coordIndex; } } IList <IList <int> > normalIndex; if (IFCImportFile.TheFile.SchemaVersion >= IFCSchemaVersion.IFC4Add2) { normalIndex = coordIndex; } else { normalIndex = IFCImportHandleUtil.GetListOfListOfIntegerAttribute(ifcTriangulatedFaceSet, "NormalIndex"); } if (normalIndex != null) { if (normalIndex.Count > 0) { NormalIndex = normalIndex; } } if (IFCImportFile.TheFile.SchemaVersion >= IFCSchemaVersion.IFC4Add2) { IList <int> pnIndex = IFCAnyHandleUtil.GetAggregateIntAttribute <List <int> >(ifcTriangulatedFaceSet, "PnIndex"); if (pnIndex != null) { if (pnIndex.Count > 0) { PnIndex = pnIndex; } } } }
/// <summary> /// Indicates whether or not the loop has the same sense when used to bound the face as when first defined. /// </summary> /// <param name="boundary">The boudary.</param> /// <returns>If false the senses of all its component oriented edges are implicitly reversed when used in the face.</returns> public static bool BoundaryHasSameSense(IFCAnyHandle boundary) { bool?hasSameSense = IFCAnyHandleUtil.GetBooleanAttribute(boundary, "Orientation"); return(hasSameSense != null ? (bool)hasSameSense : false); }