Skip to content

Commit 7f9d418

Browse files
committed
Add LARGEST_FACE_AREA to geom server
1 parent 4df526f commit 7f9d418

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

src/ifcgeomserver/IfcGeomServer.cpp

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,7 @@ static const std::string SURFACE_AREA_ALONG_X = "SURFACE_AREA_ALONG_X";
401401
static const std::string SURFACE_AREA_ALONG_Y = "SURFACE_AREA_ALONG_Y";
402402
static const std::string SURFACE_AREA_ALONG_Z = "SURFACE_AREA_ALONG_Z";
403403
static const std::string WALKABLE_SURFACE_AREA = "WALKABLE_SURFACE_AREA";
404+
static const std::string LARGEST_FACE_AREA = "LARGEST_FACE_AREA";
404405

405406
class QuantityWriter_v0 : public EntityExtension {
406407
private:
@@ -424,7 +425,7 @@ class QuantityWriter_v1 : public EntityExtension {
424425
QuantityWriter_v1(const IfcGeom::BRepElement<float, double>* elem) :
425426
elem_(elem)
426427
{
427-
double a, b, c;
428+
double a, b, c, largest_face_area = 0.;
428429

429430
if (elem_->geometry().calculate_surface_area(a)) {
430431
put_json(TOTAL_SURFACE_AREA, a);
@@ -439,6 +440,20 @@ class QuantityWriter_v1 : public EntityExtension {
439440
put_json(SURFACE_AREA_ALONG_Y, b);
440441
put_json(SURFACE_AREA_ALONG_Z, c);
441442
}
443+
444+
for (auto& part : elem->geometry()) {
445+
TopExp_Explorer exp(part.Shape(), TopAbs_FACE);
446+
while (exp.More()) {
447+
GProp_GProps prop;
448+
BRepGProp::SurfaceProperties(exp.Current(), prop);
449+
const double area = prop.Mass();
450+
if (area > largest_face_area) {
451+
largest_face_area = area;
452+
}
453+
}
454+
}
455+
456+
put_json(LARGEST_FACE_AREA, largest_face_area);
442457
}
443458
};
444459

0 commit comments

Comments
 (0)