diff --git a/src/serializers/SvgSerializer.cpp b/src/serializers/SvgSerializer.cpp index 20b38c4f21..718c1a66de 100644 --- a/src/serializers/SvgSerializer.cpp +++ b/src/serializers/SvgSerializer.cpp @@ -926,7 +926,18 @@ void SvgSerializer::write(const geometry_data& data) { TopoDS_Shape* compound_to_hlr = &compound_to_use; TopoDS_Shape subtracted_shape; - if (any_in_front && any_behind && data.product->declaration().is("IfcSlab") && is_floor_plan_) { + + bool should_subtract = false; + + if (subtraction_settings_ == ON_SLABS_AT_FLOORPLANS) { + should_subtract = data.product->declaration().is("IfcSlab") && is_floor_plan_; + } else if (subtraction_settings_ == ON_SLABS_AND_WALLS) { + should_subtract = data.product->declaration().is("IfcSlab") || data.product->declaration().is("IfcWall"); + } else if (subtraction_settings_ == ALWAYS) { + should_subtract = true; + } + + if (any_in_front && any_behind && should_subtract) { // This is currently only for slanted roof slabs on floor plans bool should_cut = false; TopExp_Explorer exp(compound_to_use, TopAbs_FACE); diff --git a/src/serializers/SvgSerializer.h b/src/serializers/SvgSerializer.h index 6ec84e7e17..c74685ea4f 100644 --- a/src/serializers/SvgSerializer.h +++ b/src/serializers/SvgSerializer.h @@ -123,6 +123,12 @@ struct drawing_meta { std::array, 3> matrix_3; }; +enum subtract_before_project { + ON_SLABS_AT_FLOORPLANS, + ON_SLABS_AND_WALLS, + ALWAYS +}; + typedef boost::variant< boost::blank, Handle(HLRBRep_Algo), @@ -182,6 +188,8 @@ protected: void draw_hlr(const gp_Pln& pln, const drawing_key& drawing_name); + subtract_before_project subtraction_settings_; + public: SvgSerializer(const stream_or_filename& out_filename, const SerializerSettings& settings) : WriteOnlyGeometrySerializer(settings) @@ -210,6 +218,7 @@ public: , ycoords_begin(0) , radii_begin(0) , namespace_prefix_("data-") + , subtraction_settings_(ON_SLABS_AT_FLOORPLANS) {} void addXCoordinate(const boost::shared_ptr& fi) { xcoords.push_back(fi); } void addYCoordinate(const boost::shared_ptr& fi) { ycoords.push_back(fi); } @@ -309,6 +318,14 @@ public: deferred_section_data_->push_back(vertical_section{ gp_Pln(gp_Ax3(pos, dir, ref)), name, include_projection }); } + void setSubtractionSettings(subtract_before_project sbp) { + subtraction_settings_ = sbp; + } + + subtract_before_project getSubtractionSettings() const { + return subtraction_settings_; + } + protected: std::string writeMetadata(const drawing_meta& m); };