@@ -177,7 +177,15 @@ bool IfcGeom::Kernel::create_solid_from_faces(const TopTools_ListOfShape& face_l
177177 builder.Perform ();
178178 shape = builder.SewedShape ();
179179 valid_shell = BRepCheck_Analyzer (shape).IsValid () != 0 && count (shape, TopAbs_SHELL) > 0 ;
180- } catch (...) {}
180+ } catch (const Standard_Failure& e) {
181+ if (e.GetMessageString () && strlen (e.GetMessageString ())) {
182+ Logger::Error (e.GetMessageString ());
183+ } else {
184+ Logger::Error (" Unknown error sewing shell" );
185+ }
186+ } catch (...) {
187+ Logger::Error (" Unknown error sewing shell" );
188+ }
181189
182190 if (valid_shell) {
183191 TopoDS_Shape complete_shape;
@@ -197,9 +205,25 @@ bool IfcGeom::Kernel::create_solid_from_faces(const TopTools_ListOfShape& face_l
197205 if (classifier.State () == TopAbs_IN) {
198206 shape.Reverse ();
199207 }
200- } catch (...) {}
208+ } catch (const Standard_Failure& e) {
209+ if (e.GetMessageString () && strlen (e.GetMessageString ())) {
210+ Logger::Error (e.GetMessageString ());
211+ } else {
212+ Logger::Error (" Unknown error classifying solid" );
213+ }
214+ } catch (...) {
215+ Logger::Error (" Unknown error classifying solid" );
216+ }
217+ }
218+ } catch (const Standard_Failure& e) {
219+ if (e.GetMessageString () && strlen (e.GetMessageString ())) {
220+ Logger::Error (e.GetMessageString ());
221+ } else {
222+ Logger::Error (" Unknown error creating solid" );
201223 }
202- } catch (...) {}
224+ } catch (...) {
225+ Logger::Error (" Unknown error creating solid" );
226+ }
203227
204228 if (complete_shape.IsNull ()) {
205229 complete_shape = result_shape;
@@ -269,7 +293,11 @@ bool IfcGeom::Kernel::convert_openings(const IfcSchema::IfcProduct* entity, cons
269293 if (fes->hasObjectPlacement ()) {
270294 try {
271295 convert (fes->ObjectPlacement (),opening_trsf);
272- } catch (...) {}
296+ } catch (const std::exception& e) {
297+ Logger::Error (e);
298+ } catch (...) {
299+ Logger::Error (" Failed to construct placement" );
300+ }
273301 }
274302
275303 // Move the opening into the coordinate system of the IfcProduct
@@ -438,7 +466,11 @@ bool IfcGeom::Kernel::convert_openings_fast(const IfcSchema::IfcProduct* entity,
438466 if (fes->hasObjectPlacement ()) {
439467 try {
440468 convert (fes->ObjectPlacement (),opening_trsf);
441- } catch (...) {}
469+ } catch (const std::exception& e) {
470+ Logger::Error (e);
471+ } catch (...) {
472+ Logger::Error (" Failed to construct placement" );
473+ }
442474 }
443475
444476 // Move the opening into the coordinate system of the IfcProduct
@@ -513,7 +545,11 @@ bool IfcGeom::Kernel::convert_openings_fast(const IfcSchema::IfcProduct* entity,
513545 if (fes->hasObjectPlacement ()) {
514546 try {
515547 convert (fes->ObjectPlacement (),opening_trsf);
516- } catch (...) {}
548+ } catch (const std::exception& e) {
549+ Logger::Error (e);
550+ } catch (...) {
551+ Logger::Error (" Failed to construct placement" );
552+ }
517553 }
518554
519555 // Move the opening into the coordinate system of the IfcProduct
@@ -597,8 +633,17 @@ bool IfcGeom::Kernel::convert_wire_to_face(const TopoDS_Wire& wire, TopoDS_Face&
597633bool IfcGeom::Kernel::convert_curve_to_wire (const Handle (Geom_Curve)& curve, TopoDS_Wire& wire) {
598634 try {
599635 wire = BRepBuilderAPI_MakeWire (BRepBuilderAPI_MakeEdge (curve));
600- } catch (...) { return false ; }
601- return true ;
636+ return true ;
637+ } catch (const Standard_Failure& e) {
638+ if (e.GetMessageString () && strlen (e.GetMessageString ())) {
639+ Logger::Error (e.GetMessageString ());
640+ } else {
641+ Logger::Error (" Unknown error convering curve to wire" );
642+ }
643+ } catch (...) {
644+ Logger::Error (" Unknown error convering curve to wire" );
645+ }
646+ return false ;
602647}
603648
604649bool IfcGeom::Kernel::profile_helper (int numVerts, double * verts, int numFillets, int * filletIndices, double * filletRadii, gp_Trsf2d trsf, TopoDS_Shape& face_shape) {
@@ -717,10 +762,12 @@ gp_Pnt IfcGeom::Kernel::point_above_plane(const gp_Pln& pln, bool agree) {
717762}
718763
719764void IfcGeom::Kernel::apply_tolerance (TopoDS_Shape& s, double t) {
765+ /*
766+ // This does not result in actionable error messages and has been disabled.
720767 ShapeAnalysis_ShapeTolerance toler;
721768 if (Logger::LOG_WARNING >= Logger::Verbosity()) {
722- if (toler.Tolerance (s, 0 ) > t + ALMOST_ZERO ) {
723- Handle_TopTools_HSequenceOfShape shapes = toler.OverTolerance (s, t + ALMOST_ZERO );
769+ if (toler.Tolerance(s, 0) > t * 10. ) {
770+ Handle_TopTools_HSequenceOfShape shapes = toler.OverTolerance(s, t * 10. );
724771 for (int i = 1; i <= shapes->Length(); ++i) {
725772 const TopoDS_Shape& sub = shapes->Value(i);
726773 std::stringstream ss;
@@ -729,6 +776,7 @@ void IfcGeom::Kernel::apply_tolerance(TopoDS_Shape& s, double t) {
729776 }
730777 }
731778 }
779+ */
732780 ShapeFix_ShapeTolerance tol;
733781 tol.LimitTolerance (s, t);
734782}
@@ -896,7 +944,15 @@ bool IfcGeom::Kernel::fill_nonmanifold_wires_with_planar_faces(TopoDS_Shape& sha
896944 ShapeFix_Solid solid;
897945 solid.LimitTolerance (getValue (GV_POINT_EQUALITY_TOLERANCE));
898946 shape = solid.SolidFromShell (TopoDS::Shell (shape));
899- } catch (...) {}
947+ } catch (const Standard_Failure& e) {
948+ if (e.GetMessageString () && strlen (e.GetMessageString ())) {
949+ Logger::Error (e.GetMessageString ());
950+ } else {
951+ Logger::Error (" Unknown error creating solid" );
952+ }
953+ } catch (...) {
954+ Logger::Error (" Unknown error creating solid" );
955+ }
900956
901957 return true ;
902958}
@@ -1133,15 +1189,21 @@ IfcGeom::BRepElement<P>* IfcGeom::Kernel::create_brep_for_representation_and_pro
11331189 if (parent_object) {
11341190 parent_id = parent_object->entity ->id ();
11351191 }
1136- } catch (...) {}
1192+ } catch (const std::exception& e) {
1193+ Logger::Error (e);
1194+ }
11371195
11381196 const std::string name = product->hasName () ? product->Name () : " " ;
11391197 const std::string guid = product->GlobalId ();
11401198
11411199 gp_Trsf trsf;
11421200 try {
11431201 convert (product->ObjectPlacement (),trsf);
1144- } catch (...) {}
1202+ } catch (const std::exception& e) {
1203+ Logger::Error (e);
1204+ } catch (...) {
1205+ Logger::Error (" Failed to construct placement" );
1206+ }
11451207
11461208 // Does the IfcElement have any IfcOpenings?
11471209 // Note that openings for IfcOpeningElements are not processed
@@ -1225,15 +1287,21 @@ IfcGeom::BRepElement<P>* IfcGeom::Kernel::create_brep_for_processed_representati
12251287 if (parent_object) {
12261288 parent_id = parent_object->entity ->id ();
12271289 }
1228- } catch (...) {}
1290+ } catch (const std::exception& e) {
1291+ Logger::Error (e);
1292+ }
12291293
12301294 const std::string name = product->hasName () ? product->Name () : " " ;
12311295 const std::string guid = product->GlobalId ();
12321296
12331297 gp_Trsf trsf;
12341298 try {
12351299 convert (product->ObjectPlacement (),trsf);
1236- } catch (...) {}
1300+ } catch (const std::exception& e) {
1301+ Logger::Error (e);
1302+ } catch (...) {
1303+ Logger::Error (" Failed to construct placement" );
1304+ }
12371305
12381306 std::string context_string = " " ;
12391307 if (representation->hasRepresentationIdentifier ()) {
@@ -1486,9 +1554,16 @@ bool IfcGeom::Kernel::convert_layerset(const IfcSchema::IfcProduct* product, std
14861554 IfcSchema::IfcExtrudedAreaSolid* extrusion = *extrusions->begin ();
14871555
14881556 gp_Trsf extrusion_position;
1489- if (!convert (extrusion->Position (), extrusion_position)) {
1490- Logger::Message (Logger::LOG_ERROR, " Failed to convert placement for extrusion of:" , product->entity );
1491- return false ;
1557+
1558+ bool has_position = true ;
1559+ #ifdef USE_IFC4
1560+ has_position = extrusion->hasPosition ();
1561+ #endif
1562+ if (has_position) {
1563+ if (!convert (extrusion->Position (), extrusion_position)) {
1564+ Logger::Message (Logger::LOG_ERROR, " Failed to convert placement for extrusion of:" , product->entity );
1565+ return false ;
1566+ }
14921567 }
14931568
14941569 gp_Dir extrusion_direction;
@@ -2255,7 +2330,15 @@ bool IfcGeom::Kernel::split_solid_by_shell(const TopoDS_Shape& input, const Topo
22552330 if (fix.Perform ()) {
22562331 shape = fix.Shape ();
22572332 }
2258- } catch (...) {}
2333+ } catch (const Standard_Failure& e) {
2334+ if (e.GetMessageString () && strlen (e.GetMessageString ())) {
2335+ Logger::Error (e.GetMessageString ());
2336+ } else {
2337+ Logger::Error (" Unknown error performing fixes" );
2338+ }
2339+ } catch (...) {
2340+ Logger::Error (" Unknown error performing fixes" );
2341+ }
22592342 BRepCheck_Analyzer analyser (shape);
22602343 bool is_valid = analyser.IsValid () != 0 ;
22612344 if (!is_valid) {
0 commit comments