From a2231605a5cf22e56b8c58225c05584b79cdfdb7 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Mon, 24 Dec 2018 16:02:00 +0100 Subject: [PATCH] Take into account edge orientation; small fixes to convert(face) --- src/ifcgeom/IfcGeomFaces.cpp | 7 +++---- src/ifcgeom/IfcGeomFunctions.cpp | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/ifcgeom/IfcGeomFaces.cpp b/src/ifcgeom/IfcGeomFaces.cpp index aab57062ad..68ac0cb1b8 100644 --- a/src/ifcgeom/IfcGeomFaces.cpp +++ b/src/ifcgeom/IfcGeomFaces.cpp @@ -218,11 +218,10 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcFace* l, TopoDS_Shape& face) { process_wire: if (face_surface.IsNull()) { - if (count(wire, TopAbs_EDGE) > 128) { + gp_Pln pln; + if (count(wire, TopAbs_EDGE) > 128 && approximate_plane_through_wire(wire, pln)) { // tfk: optimization find the underlying surface ourselves since it's going // to be planar in IFC if no explicit surface is given. Should we always do this? - gp_Pln pln; - approximate_plane_through_wire(wire, pln); mf = new BRepBuilderAPI_MakeFace(pln, wire, true); } else { mf = new BRepBuilderAPI_MakeFace(wire); @@ -245,7 +244,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcFace* l, TopoDS_Shape& face) { // In case of (non-planar) face surface, p-curves need to be computed. // For planar faces, Open Cascade generates p-curves on the fly. - if (!face_surface.IsNull()) { + if (!face_surface.IsNull() && face_surface->DynamicType() != STANDARD_TYPE(Geom_Plane)) { TopExp_Explorer exp(outer_face_bound, TopAbs_EDGE); for (; exp.More(); exp.Next()) { const TopoDS_Edge& edge = TopoDS::Edge(exp.Current()); diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index c7390985ed..69f9ec5cd3 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -3362,7 +3362,7 @@ bool IfcGeom::Kernel::wire_intersections(const TopoDS_Wire& wire, TopTools_ListO TopoDS_Edge e = wd->Edge(k + 1); TopoDS_Vertex v1, v2; - TopExp::Vertices(e, v1, v2); + TopExp::Vertices(e, v1, v2, true); const TopoDS_Vertex* v = first == forward ? &v2 : &v1; // gp_Pnt p2 = points3d.Value(1);