diff --git a/src/ifcconvert/SvgSerializer.cpp b/src/ifcconvert/SvgSerializer.cpp index 2b7413ad26..0a895ff29d 100644 --- a/src/ifcconvert/SvgSerializer.cpp +++ b/src/ifcconvert/SvgSerializer.cpp @@ -352,17 +352,14 @@ void SvgSerializer::write(const IfcGeom::BRepElement* o) if (pnt.Z() < zmin) { zmin = pnt.Z(); } if (pnt.Z() > zmax) { zmax = pnt.Z(); } }} - - if (section_height) { - if (zmin > section_height || zmax < section_height) continue; - } else { - if (zmin == inf || (zmax - zmin) < 1.) continue; - } - - // Priority: - // 1) section_height - // 2) Storey elevation + 1m - // 3) zmin + 1m + + // Empty geometry, no vertices encountered + if (zmin == inf) continue; + + // Determine slicing plane z coordinate, priority: + // 1) explicitly set global section height + // 2) containing building storey elevation + 1m + // 3) zmin (from geometry bounding box) + 1m double cut_z; if (section_height) { cut_z = section_height.get(); @@ -372,10 +369,10 @@ void SvgSerializer::write(const IfcGeom::BRepElement* o) cut_z = zmin + 1.; } + // No intersection with bounding box, fail early if (zmin > cut_z || zmax < cut_z) continue; - - // Create a horizontal cross section 1 meter above the bottom point of the shape + // Evaluate cross section geometry TopoDS_Shape result = BRepAlgoAPI_Section(moved_shape, gp_Pln(gp_Pnt(0, 0, cut_z), gp::DZ())); Handle(TopTools_HSequenceOfShape) edges = new TopTools_HSequenceOfShape();