Skip to content

Commit e3a7e61

Browse files
authored
Update SvgSerializer.cpp
1 parent 01d261e commit e3a7e61

1 file changed

Lines changed: 10 additions & 13 deletions

File tree

src/ifcconvert/SvgSerializer.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -352,17 +352,14 @@ void SvgSerializer::write(const IfcGeom::BRepElement<real_t>* o)
352352
if (pnt.Z() < zmin) { zmin = pnt.Z(); }
353353
if (pnt.Z() > zmax) { zmax = pnt.Z(); }
354354
}}
355-
356-
if (section_height) {
357-
if (zmin > section_height || zmax < section_height) continue;
358-
} else {
359-
if (zmin == inf || (zmax - zmin) < 1.) continue;
360-
}
361-
362-
// Priority:
363-
// 1) section_height
364-
// 2) Storey elevation + 1m
365-
// 3) zmin + 1m
355+
356+
// Empty geometry, no vertices encountered
357+
if (zmin == inf) continue;
358+
359+
// Determine slicing plane z coordinate, priority:
360+
// 1) explicitly set global section height
361+
// 2) containing building storey elevation + 1m
362+
// 3) zmin (from geometry bounding box) + 1m
366363
double cut_z;
367364
if (section_height) {
368365
cut_z = section_height.get();
@@ -372,10 +369,10 @@ void SvgSerializer::write(const IfcGeom::BRepElement<real_t>* o)
372369
cut_z = zmin + 1.;
373370
}
374371

372+
// No intersection with bounding box, fail early
375373
if (zmin > cut_z || zmax < cut_z) continue;
376374

377-
378-
// Create a horizontal cross section 1 meter above the bottom point of the shape
375+
// Evaluate cross section geometry
379376
TopoDS_Shape result = BRepAlgoAPI_Section(moved_shape, gp_Pln(gp_Pnt(0, 0, cut_z), gp::DZ()));
380377

381378
Handle(TopTools_HSequenceOfShape) edges = new TopTools_HSequenceOfShape();

0 commit comments

Comments
 (0)