From 9a1c7af95384c619fa439639d1399b2f25b50148 Mon Sep 17 00:00:00 2001 From: Thomas Krijnen Date: Thu, 24 Jul 2014 11:14:54 +0000 Subject: [PATCH] Fixes for IfcRectangleHollowProfileDef and filleted profile generation. --- src/ifcgeom/IfcGeomFaces.cpp | 6 +++--- src/ifcgeom/IfcGeomFunctions.cpp | 11 ++++++++--- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/ifcgeom/IfcGeomFaces.cpp b/src/ifcgeom/IfcGeomFaces.cpp index 42e3a5261d..5db0e2b46d 100644 --- a/src/ifcgeom/IfcGeomFaces.cpp +++ b/src/ifcgeom/IfcGeomFaces.cpp @@ -271,11 +271,11 @@ bool IfcGeom::convert(const IfcSchema::IfcRectangleHollowProfileDef* l, TopoDS_S const double y = l->YDim() / 2.0f * IfcGeom::GetValue(GV_LENGTH_UNIT); const double d = l->WallThickness() * IfcGeom::GetValue(GV_LENGTH_UNIT); - const bool fr1 = l->hasInnerFilletRadius(); + const bool fr1 = l->hasOuterFilletRadius(); const bool fr2 = l->hasInnerFilletRadius(); - const double r1 = fr2 ? l->OuterFilletRadius() * IfcGeom::GetValue(GV_LENGTH_UNIT) : 0.; - const double r2 = fr1 ? l->InnerFilletRadius() * IfcGeom::GetValue(GV_LENGTH_UNIT) : 0.; + const double r1 = fr1 ? l->OuterFilletRadius() * IfcGeom::GetValue(GV_LENGTH_UNIT) : 0.; + const double r2 = fr2 ? l->InnerFilletRadius() * IfcGeom::GetValue(GV_LENGTH_UNIT) : 0.; if ( x < ALMOST_ZERO || y < ALMOST_ZERO ) { Logger::Message(Logger::LOG_NOTICE,"Skipping zero sized profile:",l->entity); diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index 094fd60b5c..8c3f0a3eb9 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -25,6 +25,7 @@ #include #include +#include #include #include @@ -350,15 +351,19 @@ bool IfcGeom::profile_helper(int numVerts, double* verts, int numFillets, int* f TopoDS_Face face; IfcGeom::convert_wire_to_face(w.Wire(),face); - if ( numFillets ) { + if ( numFillets && *std::max_element(filletRadii, filletRadii + numFillets) > ALMOST_ZERO ) { BRepFilletAPI_MakeFillet2d fillet (face); for ( int i = 0; i < numFillets; i ++ ) { const double radius = filletRadii[i]; - if ( radius < ALMOST_ZERO ) continue; + if ( radius <= ALMOST_ZERO ) continue; fillet.AddFillet(vertices[filletIndices[i]],radius); } fillet.Build(); - face = TopoDS::Face(fillet.Shape()); + if (fillet.IsDone()) { + face = TopoDS::Face(fillet.Shape()); + } else { + Logger::Message(Logger::LOG_WARNING, "Failed to process profile fillets"); + } } face_shape = face;