mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-26 18:21:59 +00:00
Expose the option to sew shells from connected face sets
This commit is contained in:
@@ -81,6 +81,7 @@ namespace IfcGeom {
|
|||||||
|
|
||||||
const int DISABLE_OPENING_SUBTRACTIONS = 1 << 0;
|
const int DISABLE_OPENING_SUBTRACTIONS = 1 << 0;
|
||||||
const int DISABLE_OBJECT_PLACEMENT = 1 << 1;
|
const int DISABLE_OBJECT_PLACEMENT = 1 << 1;
|
||||||
|
const int SEW_SHELLS = 1 << 2;
|
||||||
|
|
||||||
bool convert_wire_to_face(const TopoDS_Wire& wire, TopoDS_Face& face);
|
bool convert_wire_to_face(const TopoDS_Wire& wire, TopoDS_Face& face);
|
||||||
bool convert_curve_to_wire(const Handle(Geom_Curve)& curve, TopoDS_Wire& wire);
|
bool convert_curve_to_wire(const Handle(Geom_Curve)& curve, TopoDS_Wire& wire);
|
||||||
|
|||||||
@@ -692,8 +692,15 @@ bool IfcGeom::fill_nonmanifold_wires_with_planar_faces(TopoDS_Shape& shape) {
|
|||||||
std::string IfcGeom::create_brep_data(Ifc2x3::IfcProduct* ifc_product, unsigned int settings) {
|
std::string IfcGeom::create_brep_data(Ifc2x3::IfcProduct* ifc_product, unsigned int settings) {
|
||||||
const bool no_openings = !!(settings & DISABLE_OPENING_SUBTRACTIONS);
|
const bool no_openings = !!(settings & DISABLE_OPENING_SUBTRACTIONS);
|
||||||
const bool no_placement = !!(settings & DISABLE_OBJECT_PLACEMENT);
|
const bool no_placement = !!(settings & DISABLE_OBJECT_PLACEMENT);
|
||||||
|
const bool sew_shells = !!(settings & SEW_SHELLS);
|
||||||
|
|
||||||
if (!ifc_product->hasRepresentation()) return "";
|
const double old_max_faces_to_sew = GetValue(GV_MAX_FACES_TO_SEW);
|
||||||
|
const double inf = std::numeric_limits<double>::infinity();
|
||||||
|
SetValue(GV_MAX_FACES_TO_SEW, sew_shells ? inf : -inf);
|
||||||
|
|
||||||
|
std::string brep_data = "";
|
||||||
|
|
||||||
|
if (ifc_product->hasRepresentation()) {
|
||||||
|
|
||||||
Ifc2x3::IfcProductRepresentation* prod_rep = ifc_product->Representation();
|
Ifc2x3::IfcProductRepresentation* prod_rep = ifc_product->Representation();
|
||||||
Ifc2x3::IfcRepresentation::list li = prod_rep->Representations();
|
Ifc2x3::IfcRepresentation::list li = prod_rep->Representations();
|
||||||
@@ -706,12 +713,10 @@ std::string IfcGeom::create_brep_data(Ifc2x3::IfcProduct* ifc_product, unsigned
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!shape_rep) return "";
|
if (!!shape_rep) {
|
||||||
|
|
||||||
IfcGeom::IfcRepresentationShapeItems shapes;
|
IfcGeom::IfcRepresentationShapeItems shapes;
|
||||||
if (!IfcGeom::convert_shapes(shape_rep,shapes)) {
|
if (IfcGeom::convert_shapes(shape_rep,shapes)) {
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
gp_Trsf trsf;
|
gp_Trsf trsf;
|
||||||
try {
|
try {
|
||||||
@@ -777,5 +782,12 @@ std::string IfcGeom::create_brep_data(Ifc2x3::IfcProduct* ifc_product, unsigned
|
|||||||
}
|
}
|
||||||
std::stringstream sstream;
|
std::stringstream sstream;
|
||||||
BRepTools::Write(compound,sstream);
|
BRepTools::Write(compound,sstream);
|
||||||
return sstream.str();
|
brep_data = sstream.str();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SetValue(GV_MAX_FACES_TO_SEW, old_max_faces_to_sew);
|
||||||
|
|
||||||
|
return brep_data;
|
||||||
}
|
}
|
||||||
@@ -105,6 +105,7 @@ namespace IfcParse {
|
|||||||
|
|
||||||
const int DISABLE_OPENING_SUBTRACTIONS = 1 << 0;
|
const int DISABLE_OPENING_SUBTRACTIONS = 1 << 0;
|
||||||
const int DISABLE_OBJECT_PLACEMENT = 1 << 1;
|
const int DISABLE_OBJECT_PLACEMENT = 1 << 1;
|
||||||
|
const int SEW_SHELLS = 1 << 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ostream& operator<< (std::ostream& os, const IfcParse::IfcFile& f);
|
std::ostream& operator<< (std::ostream& os, const IfcParse::IfcFile& f);
|
||||||
Reference in New Issue
Block a user