mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-21 14:23:53 +00:00
Don't sew overly complex geometries even as part of boolean operations #455
This commit is contained in:
@@ -73,6 +73,23 @@ if ( it != cache.T.end() ) { e = it->second; return true; }
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
namespace IfcGeom {
|
namespace IfcGeom {
|
||||||
|
class IFC_PARSE_API geometry_exception : public std::exception {
|
||||||
|
protected:
|
||||||
|
std::string message;
|
||||||
|
public:
|
||||||
|
geometry_exception(const std::string& m)
|
||||||
|
: message(m) {}
|
||||||
|
virtual ~geometry_exception() throw () {}
|
||||||
|
virtual const char* what() const throw() {
|
||||||
|
return message.c_str();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class IFC_PARSE_API too_many_faces_exception : public geometry_exception {
|
||||||
|
public:
|
||||||
|
too_many_faces_exception()
|
||||||
|
: geometry_exception("Too many faces for operation") {}
|
||||||
|
};
|
||||||
|
|
||||||
class IFC_GEOM_API Cache {
|
class IFC_GEOM_API Cache {
|
||||||
public:
|
public:
|
||||||
|
|||||||
@@ -174,12 +174,23 @@ bool IfcGeom::Kernel::create_solid_from_compound(const TopoDS_Shape& compound, T
|
|||||||
bool IfcGeom::Kernel::create_solid_from_faces(const TopTools_ListOfShape& face_list, TopoDS_Shape& shape) {
|
bool IfcGeom::Kernel::create_solid_from_faces(const TopTools_ListOfShape& face_list, TopoDS_Shape& shape) {
|
||||||
bool valid_shell = false;
|
bool valid_shell = false;
|
||||||
|
|
||||||
|
|
||||||
|
int max_faces = getValue(GV_MAX_FACES_TO_SEW);
|
||||||
|
if (max_faces == -1) {
|
||||||
|
max_faces = 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (face_list.Extent() > max_faces) {
|
||||||
|
throw too_many_faces_exception();
|
||||||
|
}
|
||||||
|
|
||||||
TopTools_ListIteratorOfListOfShape face_iterator;
|
TopTools_ListIteratorOfListOfShape face_iterator;
|
||||||
|
|
||||||
BRepOffsetAPI_Sewing builder;
|
BRepOffsetAPI_Sewing builder;
|
||||||
builder.SetTolerance(getValue(GV_PRECISION));
|
builder.SetTolerance(getValue(GV_PRECISION));
|
||||||
builder.SetMaxTolerance(getValue(GV_PRECISION));
|
builder.SetMaxTolerance(getValue(GV_PRECISION));
|
||||||
builder.SetMinTolerance(getValue(GV_PRECISION));
|
builder.SetMinTolerance(getValue(GV_PRECISION));
|
||||||
|
|
||||||
for (face_iterator.Initialize(face_list); face_iterator.More(); face_iterator.Next()) {
|
for (face_iterator.Initialize(face_list); face_iterator.More(); face_iterator.Next()) {
|
||||||
builder.Add(face_iterator.Value());
|
builder.Add(face_iterator.Value());
|
||||||
}
|
}
|
||||||
@@ -1324,7 +1335,9 @@ IfcGeom::BRepElement<P>* IfcGeom::Kernel::create_brep_for_representation_and_pro
|
|||||||
} else {
|
} else {
|
||||||
convert_openings(product,openings,shapes,trsf,opened_shapes);
|
convert_openings(product,openings,shapes,trsf,opened_shapes);
|
||||||
}
|
}
|
||||||
} catch(...) {
|
} catch (const std::exception& e) {
|
||||||
|
Logger::Message(Logger::LOG_ERROR, std::string("Error processing openings for: ") + e.what() + ":", product->entity);
|
||||||
|
} catch(...) {
|
||||||
Logger::Message(Logger::LOG_ERROR,"Error processing openings for:",product->entity);
|
Logger::Message(Logger::LOG_ERROR,"Error processing openings for:",product->entity);
|
||||||
}
|
}
|
||||||
if (settings.get(IteratorSettings::USE_WORLD_COORDS)) {
|
if (settings.get(IteratorSettings::USE_WORLD_COORDS)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user