diff --git a/src/ifcgeom/IfcGeom.h b/src/ifcgeom/IfcGeom.h index 3f75db42ce..5ce52afb3f 100644 --- a/src/ifcgeom/IfcGeom.h +++ b/src/ifcgeom/IfcGeom.h @@ -79,6 +79,9 @@ namespace IfcGeom { GV_PRECISION }; + const int DISABLE_OPENING_SUBTRACTIONS = 1 << 0; + const int DISABLE_OBJECT_PLACEMENT = 1 << 1; + 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_shapes(const IfcUtil::IfcBaseClass* L, IfcRepresentationShapeItems& result); @@ -103,7 +106,7 @@ namespace IfcGeom { void apply_tolerance(TopoDS_Shape& s, double t); void SetValue(GeomValue var, double value); double GetValue(GeomValue var); - std::string create_brep_data(Ifc2x3::IfcProduct* s); + std::string create_brep_data(Ifc2x3::IfcProduct* s, unsigned int settings); bool fill_nonmanifold_wires_with_planar_faces(TopoDS_Shape& shape); IfcSchema::IfcProductDefinitionShape* tesselate(TopoDS_Shape& shape, double deflection, IfcEntities es); diff --git a/src/ifcgeom/IfcGeomFunctions.cpp b/src/ifcgeom/IfcGeomFunctions.cpp index 8aa401c8a8..daf508c097 100644 --- a/src/ifcgeom/IfcGeomFunctions.cpp +++ b/src/ifcgeom/IfcGeomFunctions.cpp @@ -689,7 +689,10 @@ bool IfcGeom::fill_nonmanifold_wires_with_planar_faces(TopoDS_Shape& shape) { return true; } -std::string IfcGeom::create_brep_data(Ifc2x3::IfcProduct* ifc_product) { +std::string IfcGeom::create_brep_data(Ifc2x3::IfcProduct* ifc_product, unsigned int settings) { + const bool no_openings = !!(settings & DISABLE_OPENING_SUBTRACTIONS); + const bool no_placement = !!(settings & DISABLE_OBJECT_PLACEMENT); + if (!ifc_product->hasRepresentation()) return ""; Ifc2x3::IfcProductRepresentation* prod_rep = ifc_product->Representation(); @@ -740,23 +743,20 @@ std::string IfcGeom::create_brep_data(Ifc2x3::IfcProduct* ifc_product) { } } - if ( openings && openings->Size() ) { + if (openings && openings->Size() && !no_openings) { IfcGeom::IfcRepresentationShapeItems opened_shapes; try { IfcGeom::convert_openings(ifc_product,openings,shapes,trsf,opened_shapes); } catch(...) { Logger::Message(Logger::LOG_ERROR,"Error processing openings for:",ifc_product->entity); } - for ( IfcGeom::IfcRepresentationShapeItems::iterator it = opened_shapes.begin(); it != opened_shapes.end(); ++ it ) { - it->prepend(trsf); - } - trsf = gp_Trsf(); shapes = opened_shapes; - } else { + } + + if (!no_placement) { for ( IfcGeom::IfcRepresentationShapeItems::iterator it = shapes.begin(); it != shapes.end(); ++ it ) { it->prepend(trsf); } - trsf = gp_Trsf(); } TopoDS_Compound compound; diff --git a/src/ifcwrap/Interface.h b/src/ifcwrap/Interface.h index 6860edd7f2..d63a734be8 100644 --- a/src/ifcwrap/Interface.h +++ b/src/ifcwrap/Interface.h @@ -91,15 +91,18 @@ namespace IfcParse { return f; } - std::string create_shape(IfcParse::IfcUntypedEntity* e) { + std::string create_shape(IfcParse::IfcUntypedEntity* e, unsigned int settings = 0) { if (!e->is(IfcSchema::Type::IfcProduct)) throw IfcException("Entity is not an IfcProduct"); IfcSchema::IfcProduct* ifc_product = (IfcSchema::IfcProduct*) e; - return IfcGeom::create_brep_data(ifc_product); + return IfcGeom::create_brep_data(ifc_product, settings); } void clean() { IfcGeom::Cache::Purge(); } + + const int DISABLE_OPENING_SUBTRACTIONS = 1 << 0; + const int DISABLE_OBJECT_PLACEMENT = 1 << 1; } std::ostream& operator<< (std::ostream& os, const IfcParse::IfcFile& f); \ No newline at end of file