Skip to content

Commit 8ffd9dc

Browse files
committed
#2086 surface_area and volume
1 parent 57f6c07 commit 8ffd9dc

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/ifcwrap/IfcGeomWrapper.i

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,33 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
300300
%}
301301
};
302302

303+
%extend IfcGeom::BRepElement {
304+
double calc_volume_() const {
305+
double v;
306+
if ($self->geometry().calculate_volume(v)) {
307+
return v;
308+
} else {
309+
return std::numeric_limits<double>::quiet_NaN();
310+
}
311+
}
312+
313+
double calc_surface_area_() const {
314+
double v;
315+
if ($self->geometry().calculate_surface_area(v)) {
316+
return v;
317+
} else {
318+
return std::numeric_limits<double>::quiet_NaN();
319+
}
320+
}
321+
322+
%pythoncode %{
323+
# Hide the getters with read-only property implementations
324+
geometry = property(geometry)
325+
volume = property(calc_volume_)
326+
surface_area = property(calc_surface_area_)
327+
%}
328+
};
329+
303330
%extend IfcGeom::Material {
304331
%pythoncode %{
305332
# Hide the getters with read-only property implementations

0 commit comments

Comments
 (0)