From f58d9243fa63542f3dc3250183114998982e1f91 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Wed, 15 Jan 2020 10:35:31 +0100 Subject: [PATCH] Fix trimmed curve where vertex order does not agree with linear curve geom --- src/ifcgeom/IfcGeomWires.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/ifcgeom/IfcGeomWires.cpp b/src/ifcgeom/IfcGeomWires.cpp index 6c61661af1..d74bd361e3 100644 --- a/src/ifcgeom/IfcGeomWires.cpp +++ b/src/ifcgeom/IfcGeomWires.cpp @@ -527,6 +527,14 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcTrimmedCurve* l, TopoDS_Wire& } } else { e = me.Edge(); + // BRepBuilderAPI_MakeEdge swaps v1 and v2 if the parameter value of v2 is + // smaller than that of v1. In that case the edge has to be reversed so that + // the vertex order is consistent with Trim1 and Trim2. Otherwise the + // IfcOpenShell wire builder will create intermediate edges automatically. + // The alternative would be to reverse the underlying curve instead. + if (!TopExp::FirstVertex(e, true).IsSame(v1)) { + e.Reverse(); + } } }