Work on Python wrapper

This commit is contained in:
Thomas Krijnen
2019-08-03 15:09:50 +02:00
parent 5ccc7213a0
commit 92f7d26835
5 changed files with 19 additions and 17 deletions
@@ -24,6 +24,7 @@
#include "../../../ifcgeom/schema_agnostic/IfcGeomElement.h"
#include "../../../ifcgeom/schema_agnostic/IfcGeomIterator.h"
#include "../../../ifcgeom/schema_agnostic/Kernel.h"
#include "../../../ifcgeom/schema_agnostic/opencascade/OpenCascadeConversionResult.h"
#include <NCollection_UBTree.hxx>
#include <BRepBndLib.hxx>
+5 -5
View File
@@ -38,7 +38,7 @@ namespace IfcGeom {
private:
std::vector<P> _data;
public:
Matrix(const ElementSettings& settings, const ConversionResultPlacement* trsf) {
Matrix(const ElementSettings& settings, const IfcGeom::ConversionResultPlacement* trsf) {
// Convert the gp_Trsf into a 4x3 Matrix
// Note that in case the CONVERT_BACK_UNITS setting is enabled
// the translation component of the matrix needs to be divided
@@ -66,12 +66,12 @@ namespace IfcGeom {
ConversionResultPlacement* trsf_;
Matrix<P> matrix_;
public:
Transformation(const ElementSettings& settings, const ConversionResultPlacement* trsf)
Transformation(const ElementSettings& settings, const IfcGeom::ConversionResultPlacement* trsf)
: settings_(settings)
, trsf_(trsf ? trsf->clone() : nullptr)
, matrix_(settings, trsf)
{}
const ConversionResultPlacement* data() const { return trsf_; }
const IfcGeom::ConversionResultPlacement* data() const { return trsf_; }
const Matrix<P>& matrix() const { return matrix_; }
Transformation inverted() const {
@@ -133,7 +133,7 @@ namespace IfcGeom {
void SetParents(std::vector<const IfcGeom::Element<P, PP>*> newparents) { _parents = newparents; }
Element(const ElementSettings& settings, int id, int parent_id, const std::string& name, const std::string& type,
const std::string& guid, const std::string& context, const ConversionResultPlacement* trsf, IfcUtil::IfcBaseEntity* product)
const std::string& guid, const std::string& context, const IfcGeom::ConversionResultPlacement* trsf, IfcUtil::IfcBaseEntity* product)
: _id(id), _parent_id(parent_id), _name(name), _type(type), _guid(guid), _context(context), _transformation(settings, trsf)
, product_(product)
{
@@ -170,7 +170,7 @@ namespace IfcGeom {
const boost::shared_ptr<Representation::BRep>& geometry_pointer() const { return _geometry; }
const Representation::BRep& geometry() const { return *_geometry; }
NativeElement(int id, int parent_id, const std::string& name, const std::string& type, const std::string& guid,
const std::string& context, const ConversionResultPlacement* trsf, const boost::shared_ptr<Representation::BRep>& geometry,
const std::string& context, const IfcGeom::ConversionResultPlacement* trsf, const boost::shared_ptr<Representation::BRep>& geometry,
IfcUtil::IfcBaseEntity* product)
: Element<P, PP>(geometry->settings() ,id, parent_id, name, type, guid, context, trsf, product)
, _geometry(geometry)
@@ -60,11 +60,11 @@ namespace IfcGeom {
IfcGeom::ConversionResults::const_iterator end() const { return shapes_.end(); }
const IfcGeom::ConversionResults& shapes() const { return shapes_; }
const std::string& id() const { return id_; }
ConversionResultShape* as_compound(bool force_meters = false) const;
IfcGeom::ConversionResultShape* as_compound(bool force_meters = false) const;
bool calculate_volume(double&) const;
bool calculate_surface_area(double&) const;
bool calculate_projected_surface_area(const ConversionResultPlacement* ax, double& along_x, double& along_y, double& along_z) const;
bool calculate_projected_surface_area(const IfcGeom::ConversionResultPlacement* ax, double& along_x, double& along_y, double& along_z) const;
};
class IFC_GEOM_API Serialization : public Representation {
+10 -9
View File
@@ -38,16 +38,16 @@
%ignore IfcGeom::impl::tree::selector;
%include "../ifcgeom/ifc_geom_api.h"
%include "../ifcgeom/IfcGeomIteratorSettings.h"
%include "../ifcgeom/IfcGeomElement.h"
%include "../ifcgeom_schema_agnostic/IfcGeomMaterial.h"
%include "../ifcgeom/IfcGeomRepresentation.h"
%include "../ifcgeom_schema_agnostic/IfcGeomIterator.h"
%include "../ifcgeom/schema_agnostic/ifc_geom_api.h"
%include "../ifcgeom/schema_agnostic/IfcGeomIteratorSettings.h"
%include "../ifcgeom/schema_agnostic/IfcGeomElement.h"
%include "../ifcgeom/schema_agnostic/IfcGeomMaterial.h"
%include "../ifcgeom/schema_agnostic/IfcGeomRepresentation.h"
%include "../ifcgeom/schema_agnostic/IfcGeomIterator.h"
// A Template instantantation should be defined before it is used as a base class.
// But frankly I don't care as most methods are subtlely different anyway.
%include "../ifcgeom/IfcGeomTree.h"
%include "../ifcgeom/kernels/opencascade/IfcGeomTree.h"
%extend IfcGeom::tree {
@@ -277,8 +277,9 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
template <typename Schema>
static boost::variant<IfcGeom::Element<double>*, IfcGeom::Representation::Representation*> helper_fn_create_shape(IfcGeom::IteratorSettings& settings, IfcUtil::IfcBaseClass* instance, IfcUtil::IfcBaseClass* representation = 0) {
IfcParse::IfcFile* file = instance->data().file;
IfcGeom::Kernel kernel(file);
// @todo Default to opencascade for now.
IfcGeom::Kernel kernel("opencascade", file);
kernel.setValue(IfcGeom::Kernel::GV_MAX_FACES_TO_ORIENT, settings.get(IfcGeom::IteratorSettings::SEW_SHELLS) ? std::numeric_limits<double>::infinity() : -1);
kernel.setValue(IfcGeom::Kernel::GV_DIMENSIONALITY, (settings.get(IfcGeom::IteratorSettings::INCLUDE_CURVES) ? (settings.get(IfcGeom::IteratorSettings::EXCLUDE_SOLIDS_AND_SURFACES) ? -1. : 0.) : +1.));
+1 -1
View File
@@ -72,7 +72,7 @@
%module ifcopenshell_wrapper %{
#include "../ifcgeom/schema_agnostic/IfcGeomIterator.h"
#include "../ifcgeom/schema_agnostic/Serialization.h"
#include "../ifcgeom/IfcGeomTree.h"
#include "../ifcgeom/kernels/opencascade/IfcGeomTree.h"
#include "../ifcparse/Ifc2x3.h"
#include "../ifcparse/Ifc4.h"