Geometry serialization (#71)

Serialize geometry to IFC instances directly from a TopoDS_Shape
This commit is contained in:
Thomas Krijnen
2016-06-22 15:03:18 +02:00
committed by GitHub
parent 90ad3a4a93
commit aebb9e324b
18 changed files with 1161 additions and 206 deletions
+28
View File
@@ -389,6 +389,34 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
}
return boost::variant<IfcGeom::Element<double>*, IfcGeom::Representation::Representation*>();
}
IfcParse::IfcLateBoundEntity* serialise(const std::string& s, bool advanced=true) {
std::stringstream stream(s);
BRepTools_ShapeSet shapes;
shapes.Read(stream);
const TopoDS_Shape& shp = shapes.Shape(shapes.NbShapes());
const IfcUtil::IfcBaseClass* e = IfcGeom::serialise(shp, advanced);
if (e) {
return new IfcParse::IfcLateBoundEntity(e->entity);
} else {
return 0;
}
}
IfcParse::IfcLateBoundEntity* tesselate(const std::string& s, double d) {
std::stringstream stream(s);
BRepTools_ShapeSet shapes;
shapes.Read(stream);
const TopoDS_Shape& shp = shapes.Shape(shapes.NbShapes());
const IfcUtil::IfcBaseClass* e = IfcGeom::tesselate(shp, d);
if (e) {
return new IfcParse::IfcLateBoundEntity(e->entity);
} else {
return 0;
}
}
%}
namespace IfcGeom {
+2
View File
@@ -76,6 +76,8 @@
#else
#include "../ifcparse/Ifc2x3-latebound.h"
#endif
#include <BRepTools_ShapeSet.hxx>
%}
%include "utils/type_conversion.i"