mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 02:31:09 +00:00
Remove dependency on Standard_failure #7788
This commit is contained in:
@@ -620,17 +620,7 @@ const IfcGeom::Element* IfcGeom::Iterator::get_object(int id) {
|
|||||||
}
|
}
|
||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
Logger::Error(e);
|
Logger::Error(e);
|
||||||
}
|
} catch (...) {
|
||||||
#ifdef IFOPSH_WITH_OPENCASCADE
|
|
||||||
catch (const Standard_Failure& e) {
|
|
||||||
if (e.GetMessageString() && strlen(e.GetMessageString())) {
|
|
||||||
Logger::Error(e.GetMessageString());
|
|
||||||
} else {
|
|
||||||
Logger::Error("Unknown error returning product");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
catch (...) {
|
|
||||||
Logger::Error("Unknown error returning product");
|
Logger::Error("Unknown error returning product");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -645,18 +635,7 @@ const IfcUtil::IfcBaseClass* IfcGeom::Iterator::create() {
|
|||||||
} catch (const std::exception& e) {
|
} catch (const std::exception& e) {
|
||||||
Logger::Error(e);
|
Logger::Error(e);
|
||||||
had_error_processing_elements_ = true;
|
had_error_processing_elements_ = true;
|
||||||
}
|
} catch (...) {
|
||||||
#ifdef IFOPSH_WITH_OPENCASCADE
|
|
||||||
catch (const Standard_Failure& e) {
|
|
||||||
if (e.GetMessageString() && strlen(e.GetMessageString())) {
|
|
||||||
Logger::Error(e.GetMessageString());
|
|
||||||
} else {
|
|
||||||
Logger::Error("Unknown error creating geometry");
|
|
||||||
}
|
|
||||||
had_error_processing_elements_ = true;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
catch (...) {
|
|
||||||
Logger::Error("Unknown error creating geometry");
|
Logger::Error("Unknown error creating geometry");
|
||||||
had_error_processing_elements_ = true;
|
had_error_processing_elements_ = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,10 +68,6 @@
|
|||||||
#include "../ifcgeom/abstract_mapping.h"
|
#include "../ifcgeom/abstract_mapping.h"
|
||||||
#include "../ifcgeom/GeometrySerializer.h"
|
#include "../ifcgeom/GeometrySerializer.h"
|
||||||
|
|
||||||
#ifdef IFOPSH_WITH_OPENCASCADE
|
|
||||||
#include <Standard_Failure.hxx>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -56,6 +56,21 @@
|
|||||||
#include "../../../ifcgeom/taxonomy.h"
|
#include "../../../ifcgeom/taxonomy.h"
|
||||||
#include "../../../ifcgeom/ConversionSettings.h"
|
#include "../../../ifcgeom/ConversionSettings.h"
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
template <typename Fn>
|
||||||
|
bool handle_occt_exception(Fn&& fn) {
|
||||||
|
try {
|
||||||
|
return std::forward<Fn>(fn)();
|
||||||
|
} catch (const Standard_Failure& e) {
|
||||||
|
if (e.GetMessageString() && strlen(e.GetMessageString())) {
|
||||||
|
throw std::runtime_error(e.GetMessageString());
|
||||||
|
} else {
|
||||||
|
throw std::runtime_error("Unknown error creating geometry");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace IfcGeom {
|
namespace IfcGeom {
|
||||||
|
|
||||||
class IFC_GEOMLIBRARY_API OpenCascadeKernel : public ifcopenshell::geometry::kernels::AbstractKernel {
|
class IFC_GEOMLIBRARY_API OpenCascadeKernel : public ifcopenshell::geometry::kernels::AbstractKernel {
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OpenCascadeKernel::convert_impl(const taxonomy::boolean_result::ptr br, ConversionResults& results) {
|
bool OpenCascadeKernel::convert_impl(const taxonomy::boolean_result::ptr br, ConversionResults& results) {
|
||||||
|
return handle_occt_exception([&]() -> bool {
|
||||||
bool valid_result = false;
|
bool valid_result = false;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
const double tol = settings_.get<settings::Precision>().get();
|
const double tol = settings_.get<settings::Precision>().get();
|
||||||
@@ -196,4 +197,5 @@ bool OpenCascadeKernel::convert_impl(const taxonomy::boolean_result::ptr br, Con
|
|||||||
));
|
));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -72,6 +72,8 @@ bool OpenCascadeKernel::convert(const taxonomy::extrusion::ptr extrusion, TopoDS
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OpenCascadeKernel::convert_impl(const taxonomy::extrusion::ptr extrusion, IfcGeom::ConversionResults& results) {
|
bool OpenCascadeKernel::convert_impl(const taxonomy::extrusion::ptr extrusion, IfcGeom::ConversionResults& results) {
|
||||||
|
return handle_occt_exception([&]() -> bool {
|
||||||
|
|
||||||
TopoDS_Shape shape;
|
TopoDS_Shape shape;
|
||||||
if (!convert(extrusion, shape)) {
|
if (!convert(extrusion, shape)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -84,4 +86,6 @@ bool OpenCascadeKernel::convert_impl(const taxonomy::extrusion::ptr extrusion, I
|
|||||||
extrusion->surface_style
|
extrusion->surface_style
|
||||||
));
|
));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -599,6 +599,8 @@ bool OpenCascadeKernel::convert(const taxonomy::face::ptr face, TopoDS_Shape& re
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OpenCascadeKernel::convert_impl(const taxonomy::face::ptr face, IfcGeom::ConversionResults& results) {
|
bool OpenCascadeKernel::convert_impl(const taxonomy::face::ptr face, IfcGeom::ConversionResults& results) {
|
||||||
|
return handle_occt_exception([&]() -> bool {
|
||||||
|
|
||||||
TopoDS_Shape shape;
|
TopoDS_Shape shape;
|
||||||
if (!convert(face, shape)) {
|
if (!convert(face, shape)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -609,4 +611,6 @@ bool OpenCascadeKernel::convert_impl(const taxonomy::face::ptr face, IfcGeom::Co
|
|||||||
face->surface_style
|
face->surface_style
|
||||||
));
|
));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -427,6 +427,8 @@ bool OpenCascadeKernel::convert(const taxonomy::loft::ptr loft, TopoDS_Shape& re
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OpenCascadeKernel::convert_impl(const taxonomy::loft::ptr loft, IfcGeom::ConversionResults& results) {
|
bool OpenCascadeKernel::convert_impl(const taxonomy::loft::ptr loft, IfcGeom::ConversionResults& results) {
|
||||||
|
return handle_occt_exception([&]() -> bool {
|
||||||
|
|
||||||
TopoDS_Shape shape;
|
TopoDS_Shape shape;
|
||||||
if (!convert(loft, shape)) {
|
if (!convert(loft, shape)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -438,4 +440,6 @@ bool OpenCascadeKernel::convert_impl(const taxonomy::loft::ptr loft, IfcGeom::Co
|
|||||||
loft->surface_style
|
loft->surface_style
|
||||||
));
|
));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -378,6 +378,8 @@ bool OpenCascadeKernel::convert(const taxonomy::loop::ptr loop, TopoDS_Wire& wir
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OpenCascadeKernel::convert_impl(const taxonomy::loop::ptr loop, IfcGeom::ConversionResults& results) {
|
bool OpenCascadeKernel::convert_impl(const taxonomy::loop::ptr loop, IfcGeom::ConversionResults& results) {
|
||||||
|
return handle_occt_exception([&]() -> bool {
|
||||||
|
|
||||||
TopoDS_Wire shape;
|
TopoDS_Wire shape;
|
||||||
if (!convert(loop, shape)) {
|
if (!convert(loop, shape)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -389,9 +391,13 @@ bool OpenCascadeKernel::convert_impl(const taxonomy::loop::ptr loop, IfcGeom::Co
|
|||||||
loop->surface_style
|
loop->surface_style
|
||||||
));
|
));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
bool OpenCascadeKernel::convert_impl(const taxonomy::edge::ptr edge, IfcGeom::ConversionResults& results) {
|
bool OpenCascadeKernel::convert_impl(const taxonomy::edge::ptr edge, IfcGeom::ConversionResults& results) {
|
||||||
|
return handle_occt_exception([&]() -> bool {
|
||||||
|
|
||||||
TopoDS_Wire shape = boost::get<TopoDS_Wire>(convert_curve(edge));
|
TopoDS_Wire shape = boost::get<TopoDS_Wire>(convert_curve(edge));
|
||||||
|
|
||||||
results.emplace_back(ConversionResult(
|
results.emplace_back(ConversionResult(
|
||||||
@@ -400,4 +406,6 @@ bool OpenCascadeKernel::convert_impl(const taxonomy::edge::ptr edge, IfcGeom::Co
|
|||||||
edge->surface_style
|
edge->surface_style
|
||||||
));
|
));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ bool OpenCascadeKernel::convert(const taxonomy::shell::ptr l, TopoDS_Shape& shap
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OpenCascadeKernel::convert_impl(const taxonomy::shell::ptr shell, IfcGeom::ConversionResults& results) {
|
bool OpenCascadeKernel::convert_impl(const taxonomy::shell::ptr shell, IfcGeom::ConversionResults& results) {
|
||||||
|
return handle_occt_exception([&]() -> bool {
|
||||||
|
|
||||||
TopoDS_Shape shape;
|
TopoDS_Shape shape;
|
||||||
if (!convert(shell, shape)) {
|
if (!convert(shell, shape)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -118,4 +120,6 @@ bool OpenCascadeKernel::convert_impl(const taxonomy::shell::ptr shell, IfcGeom::
|
|||||||
shell->surface_style
|
shell->surface_style
|
||||||
));
|
));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ bool OpenCascadeKernel::convert(const taxonomy::solid::ptr solid, TopoDS_Shape&
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OpenCascadeKernel::convert_impl(const taxonomy::solid::ptr solid, IfcGeom::ConversionResults& results) {
|
bool OpenCascadeKernel::convert_impl(const taxonomy::solid::ptr solid, IfcGeom::ConversionResults& results) {
|
||||||
|
return handle_occt_exception([&]() -> bool {
|
||||||
|
|
||||||
TopoDS_Shape shape;
|
TopoDS_Shape shape;
|
||||||
if (!convert(solid, shape)) {
|
if (!convert(solid, shape)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -113,4 +115,6 @@ bool OpenCascadeKernel::convert_impl(const taxonomy::solid::ptr solid, IfcGeom::
|
|||||||
solid->surface_style
|
solid->surface_style
|
||||||
));
|
));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -308,6 +308,8 @@ bool OpenCascadeKernel::convert(const taxonomy::sweep_along_curve::ptr scs, Topo
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool OpenCascadeKernel::convert_impl(const taxonomy::sweep_along_curve::ptr scs, IfcGeom::ConversionResults& results) {
|
bool OpenCascadeKernel::convert_impl(const taxonomy::sweep_along_curve::ptr scs, IfcGeom::ConversionResults& results) {
|
||||||
|
return handle_occt_exception([&]() -> bool {
|
||||||
|
|
||||||
TopoDS_Shape shape;
|
TopoDS_Shape shape;
|
||||||
// For tiny radii occt will fail building the sweep, in which case we enlarge the inputs to occt, and add a scale matrix to the output
|
// For tiny radii occt will fail building the sweep, in which case we enlarge the inputs to occt, and add a scale matrix to the output
|
||||||
bool enlarged = false;
|
bool enlarged = false;
|
||||||
@@ -352,4 +354,6 @@ bool OpenCascadeKernel::convert_impl(const taxonomy::sweep_along_curve::ptr scs,
|
|||||||
scs->surface_style
|
scs->surface_style
|
||||||
));
|
));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user