diff --git a/src/ifcconvert/IfcConvert.cpp b/src/ifcconvert/IfcConvert.cpp index 7df682e61c..e0d839c2c3 100644 --- a/src/ifcconvert/IfcConvert.cpp +++ b/src/ifcconvert/IfcConvert.cpp @@ -354,7 +354,7 @@ int main(int argc, char** argv) { short precision; double section_height; std::string svg_scale, svg_center; - std::string section_ref, elevation_ref; + std::string section_ref, elevation_ref, elevation_ref_guid; // "none", "full" or "left" std::string storey_height_display; SvgSerializer::storey_height_display_types svg_storey_height_display = SvgSerializer::SH_NONE; @@ -376,9 +376,11 @@ int main(int argc, char** argv) { "When using --scale, specifies the location in the range [0 1]x[0 1] around which" "to center the drawings. Example 0.5x0.5 (default).") ("section-ref", po::value(§ion_ref), - "Element at which vertical cross sections should be created") + "Element at which cross sections should be created") ("elevation-ref", po::value(&elevation_ref), - "Element at which vertical elevations should be created") + "Element at which drawings should be created") + ("elevation-ref-guid", po::value(&elevation_ref_guid), + "Element guids at which drawings should be created") ("auto-section", "Creates SVG cross section drawings automatically based on model extents") ("auto-elevation", @@ -1003,6 +1005,9 @@ int main(int argc, char** argv) { if (vmap.count("elevation-ref")) { static_cast(serializer.get())->setElevationRef(elevation_ref); } + if (vmap.count("elevation-ref-guid")) { + static_cast(serializer.get())->setElevationRefGuid(elevation_ref_guid); + } if (vmap.count("auto-section")) { static_cast(serializer.get())->setAutoSection(true); } diff --git a/src/serializers/SvgSerializer.cpp b/src/serializers/SvgSerializer.cpp index 2a5c18dc6e..9e1ec70b27 100644 --- a/src/serializers/SvgSerializer.cpp +++ b/src/serializers/SvgSerializer.cpp @@ -543,7 +543,12 @@ void SvgSerializer::write(const IfcGeom::BRepElement* brep_obj) { const gp_Trsf& trsf = brep_obj->transformation().data(); const bool is_section = (section_ref_ && object_type && *section_ref_ == *object_type); - const bool is_elevation = (elevation_ref_ && object_type && *elevation_ref_ == *object_type); + bool is_elevation = false; + if (elevation_ref_ && object_type) { + is_elevation = *elevation_ref_ == *object_type; + } else if (elevation_ref_guid_) { + is_elevation = *elevation_ref_guid_ == brep_obj->guid(); + } if (is_section || is_elevation) { BRepBuilderAPI_Transform make_transform_global(compound_local, trsf, true); diff --git a/src/serializers/SvgSerializer.h b/src/serializers/SvgSerializer.h index 957bc1aa90..df3cd62503 100644 --- a/src/serializers/SvgSerializer.h +++ b/src/serializers/SvgSerializer.h @@ -167,7 +167,7 @@ protected: float_item_list xcoords, ycoords, radii; size_t xcoords_begin, ycoords_begin, radii_begin; - boost::optional section_ref_, elevation_ref_; + boost::optional section_ref_, elevation_ref_, elevation_ref_guid_; std::list element_buffer_; @@ -242,8 +242,15 @@ public: void setSectionRef(const boost::optional& s) { section_ref_ = s; } + void setElevationRef(const boost::optional& s) { elevation_ref_ = s; + elevation_ref_guid_ = boost::none; + } + + void setElevationRefGuid(const boost::optional& s) { + elevation_ref_ = boost::none; + elevation_ref_guid_ = s; } void setAutoSection(bool b) {