override protected void Process(IFCAnyHandle ifcPolyLoop) { base.Process(ifcPolyLoop); List <IFCAnyHandle> ifcPolygon = IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(ifcPolyLoop, "Polygon"); if (ifcPolygon == null) { return; // TODO: WARN } Polygon = IFCPoint.ProcessScaledLengthIFCCartesianPoints(ifcPolygon); int numVertices = Polygon.Count; if (numVertices > 1) { if (Polygon[0].IsAlmostEqualTo(Polygon[numVertices - 1])) { // LOG: Warning: #: First and last points are almost identical, removing extra point. Polygon.RemoveAt(numVertices - 1); numVertices--; } } if (numVertices < 3) { throw new InvalidOperationException("#" + ifcPolyLoop.StepId + ": Polygon attribute has only " + numVertices + " vertices, 3 expected."); } }
override protected void Process(IFCAnyHandle ifcPolyLoop) { base.Process(ifcPolyLoop); List <IFCAnyHandle> ifcPolygon = IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(ifcPolyLoop, "Polygon"); if (ifcPolygon == null) { return; // TODO: WARN } Polygon = IFCPoint.ProcessScaledLengthIFCCartesianPoints(ifcPolygon); // Check for duplicate points, including wrapping around, and remove them. int numVertices = Polygon.Count; for (int ii = numVertices - 1; (ii != -1) && numVertices >= 3; ii--) { if (MathUtil.IsAlmostEqualAbsolute(Polygon[ii], Polygon[(ii + 1) % numVertices])) { Importer.TheLog.LogError(ifcPolyLoop.StepId, "The polygon vertex at index " + ii + " is a duplicate, removing.", false); Polygon.RemoveAt(ii); numVertices--; } } if (numVertices < 3) { // This used to throw an error. However, we found files that threw this error // thousands of times, causing incredibly slow links. Instead, null out the // data and log an error. Polygon = null; Importer.TheLog.LogError(ifcPolyLoop.StepId, "Polygon attribute has only " + numVertices + " vertices, 3 expected.", false); } }
override protected void Process(IFCAnyHandle ifcPolyLoop) { base.Process(ifcPolyLoop); List <IFCAnyHandle> ifcPolygon = IFCAnyHandleUtil.GetAggregateInstanceAttribute <List <IFCAnyHandle> >(ifcPolyLoop, "Polygon"); if (ifcPolygon == null) { return; // TODO: WARN } Polygon = IFCPoint.ProcessScaledLengthIFCCartesianPoints(ifcPolygon); int numVertices = Polygon.Count; if (numVertices > 1) { if (MathUtil.IsAlmostEqualAbsolute(Polygon[0], Polygon[numVertices - 1])) { // LOG: Warning: #: First and last points are almost identical, removing extra point. Polygon.RemoveAt(numVertices - 1); numVertices--; } } if (numVertices < 3) { // This used to throw an error. However, we found files that threw this error // thousands of times, causing incredibly slow links. Instead, null out the // data and log an error. Polygon = null; Importer.TheLog.LogError(ifcPolyLoop.StepId, "Polygon attribute has only " + numVertices + " vertices, 3 expected.", false); } }
protected override void Process(IFCAnyHandle ifcSurface) { base.Process(ifcSurface); bool foundUDegree = false; UDegree = IFCImportHandleUtil.GetRequiredIntegerAttribute(ifcSurface, "UDegree", out foundUDegree); if (!foundUDegree) { Importer.TheLog.LogError(ifcSurface.StepId, "Cannot find the UDegree attribute of this surface", true); } bool foundVDegree = false; VDegree = IFCImportHandleUtil.GetRequiredIntegerAttribute(ifcSurface, "VDegree", out foundVDegree); if (!foundVDegree) { Importer.TheLog.LogError(ifcSurface.StepId, "Cannot find the VDegree attribute of this surface", true); } IList <IList <IFCAnyHandle> > controlPoints = IFCImportHandleUtil.GetListOfListOfInstanceAttribute(ifcSurface, "ControlPointsList"); if (controlPoints == null || controlPoints.Count == 0) { Importer.TheLog.LogError(ifcSurface.StepId, "This surface has invalid number of control points", true); } List <IFCAnyHandle> controlPointsTmp = new List <IFCAnyHandle>(); foreach (List <IFCAnyHandle> list in controlPoints) { controlPointsTmp.AddRange(list); } ControlPointsList = IFCPoint.ProcessScaledLengthIFCCartesianPoints(controlPointsTmp); bool foundUClosed = false; UClosed = IFCImportHandleUtil.GetOptionalLogicalAttribute(ifcSurface, "UClosed", out foundUClosed); if (!foundUClosed) { Importer.TheLog.LogWarning(ifcSurface.StepId, "Cannot find the UClosed attribute of this surface, setting to Unknown", true); UClosed = IFCLogical.Unknown; } bool foundVClosed = false; VClosed = IFCImportHandleUtil.GetOptionalLogicalAttribute(ifcSurface, "VClosed", out foundVClosed); if (!foundVClosed) { Importer.TheLog.LogWarning(ifcSurface.StepId, "Cannot find the VClosed attribute of this surface, setting to Unknown", true); VClosed = IFCLogical.Unknown; } }