From aad6c77d0059fdfe32e7abb6c72f64db16b4d4e2 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Tue, 3 Mar 2015 19:18:51 +0000 Subject: [PATCH] Skip IfcSweptDiskSolid.InnerRadii under IfcGeometricRepresentationContext.Precision. Thanks Stefan. --- src/ifcgeom/IfcGeomShapes.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ifcgeom/IfcGeomShapes.cpp b/src/ifcgeom/IfcGeomShapes.cpp index e6c0e47469..f9f905d6c5 100644 --- a/src/ifcgeom/IfcGeomShapes.cpp +++ b/src/ifcgeom/IfcGeomShapes.cpp @@ -724,7 +724,7 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcSurfaceCurveSweptAreaSolid* l, bool IfcGeom::Kernel::convert(const IfcSchema::IfcSweptDiskSolid* l, TopoDS_Shape& shape) { TopoDS_Wire wire, section1, section2; - const bool hasInnerRadius = l->hasInnerRadius(); + bool hasInnerRadius = l->hasInnerRadius(); if (!convert_wire(l->Directrix(), wire)) { return false; @@ -748,8 +748,13 @@ bool IfcGeom::Kernel::convert(const IfcSchema::IfcSweptDiskSolid* l, TopoDS_Shap if (hasInnerRadius) { const double r2 = l->InnerRadius() * getValue(GV_LENGTH_UNIT); - Handle(Geom_Circle) circle = new Geom_Circle(directrix, r2); - section2 = BRepBuilderAPI_MakeWire(BRepBuilderAPI_MakeEdge(circle)); + if (r2 < getValue(GV_PRECISION)) { + // Subtraction of pipes with small radii is unstable. + hasInnerRadius = false; + } else { + Handle(Geom_Circle) circle = new Geom_Circle(directrix, r2); + section2 = BRepBuilderAPI_MakeWire(BRepBuilderAPI_MakeEdge(circle)); + } } // NB: Note that StartParam and EndParam param are ignored and the assumption is