mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-09 09:21:46 +00:00
Revert some of the typemap work in b96cf38e17 and rely on a general mapping from const vector to tuple
This commit is contained in:
@@ -93,47 +93,6 @@
|
||||
%ignore IfcGeom::Iterator<double>::Iterator(const IfcGeom::IteratorSettings&, void*, int);
|
||||
%ignore IfcGeom::Iterator<double>::Iterator(const IfcGeom::IteratorSettings&, std::istream&, int);
|
||||
|
||||
// Ignore the std::vector accessors and replace them to pairs that will
|
||||
// be expanded to Python tuples by means of typemaps. This in order to
|
||||
// minimize passing STL objects across dynamic library boundaries.
|
||||
%ignore IfcGeom::Representation::Triangulation::verts;
|
||||
%ignore IfcGeom::Representation::Triangulation::faces;
|
||||
%ignore IfcGeom::Representation::Triangulation::edges;
|
||||
%ignore IfcGeom::Representation::Triangulation::normals;
|
||||
%ignore IfcGeom::Representation::Triangulation::material_ids;
|
||||
%ignore IfcGeom::Representation::Triangulation::materials;
|
||||
%extend IfcGeom::Representation::Triangulation {
|
||||
std::pair<const int*, unsigned> get_faces() {
|
||||
return std::make_pair(&$self->faces()[0], $self->faces().size());
|
||||
}
|
||||
std::pair<const int*, unsigned> get_edges() {
|
||||
return std::make_pair(&$self->edges()[0], $self->edges().size());
|
||||
}
|
||||
std::pair<const int*, unsigned> get_material_ids() {
|
||||
return std::make_pair(&$self->material_ids()[0], $self->material_ids().size());
|
||||
}
|
||||
std::pair<const IfcGeom::Material*, unsigned> get_materials() {
|
||||
return std::make_pair(&$self->materials()[0], $self->materials().size());
|
||||
}
|
||||
}
|
||||
%extend IfcGeom::Representation::Triangulation<float> {
|
||||
std::pair<const float*, unsigned> get_verts() {
|
||||
return std::make_pair(&$self->verts()[0], $self->verts().size());
|
||||
}
|
||||
std::pair<const float*, unsigned> get_normals() {
|
||||
return std::make_pair(&$self->normals()[0], $self->normals().size());
|
||||
}
|
||||
}
|
||||
%extend IfcGeom::Representation::Triangulation<double> {
|
||||
std::pair<const double*, unsigned> get_verts() {
|
||||
return std::make_pair(&$self->verts()[0], $self->verts().size());
|
||||
}
|
||||
std::pair<const double*, unsigned> get_normals() {
|
||||
return std::make_pair(&$self->normals()[0], $self->normals().size());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
%extend IfcGeom::IteratorSettings {
|
||||
%pythoncode %{
|
||||
attrs = ("convert_back_units", "deflection_tolerance", "disable_opening_subtractions", "disable_triangulation", "faster_booleans", "sew_shells", "use_brep_data", "use_world_coords", "weld_vertices")
|
||||
@@ -159,10 +118,10 @@
|
||||
if _newclass:
|
||||
# Hide the getters with read-only property implementations
|
||||
id = property(id)
|
||||
faces = property(get_faces)
|
||||
edges = property(get_edges)
|
||||
material_ids = property(get_material_ids)
|
||||
materials = property(get_materials)
|
||||
faces = property(faces)
|
||||
edges = property(edges)
|
||||
material_ids = property(material_ids)
|
||||
materials = property(materials)
|
||||
%}
|
||||
};
|
||||
|
||||
@@ -172,16 +131,16 @@
|
||||
%pythoncode %{
|
||||
if _newclass:
|
||||
# Hide the getters with read-only property implementations
|
||||
verts = property(get_verts)
|
||||
normals = property(get_normals)
|
||||
verts = property(verts)
|
||||
normals = property(normals)
|
||||
%}
|
||||
};
|
||||
%extend IfcGeom::Representation::Triangulation<double> {
|
||||
%pythoncode %{
|
||||
if _newclass:
|
||||
# Hide the getters with read-only property implementations
|
||||
verts = property(get_verts)
|
||||
normals = property(get_normals)
|
||||
verts = property(verts)
|
||||
normals = property(normals)
|
||||
%}
|
||||
};
|
||||
|
||||
|
||||
@@ -112,7 +112,9 @@
|
||||
PyObject* pythonize(const double& t) { return PyFloat_FromDouble(t); }
|
||||
PyObject* pythonize(const std::string& t) { return PyString_FromString(t.c_str()); }
|
||||
PyObject* pythonize(const IfcUtil::IfcBaseClass* t) { return SWIG_NewPointerObj(SWIG_as_voidptr(t), SWIGTYPE_p_IfcParse__IfcLateBoundEntity, 0); }
|
||||
|
||||
// NB: This cannot be temporary as a Python object is constructed from a pointer to the address of this object
|
||||
PyObject* pythonize(const IfcGeom::Material& t) { return SWIG_NewPointerObj(SWIG_as_voidptr(&t), SWIGTYPE_p_IfcGeom__Material, 0); }
|
||||
|
||||
PyObject* pythonize(const boost::dynamic_bitset<>& t) {
|
||||
std::string bitstring;
|
||||
boost::to_string(t, bitstring);
|
||||
|
||||
@@ -105,3 +105,4 @@ CREATE_VECTOR_TYPEMAP_OUT(int)
|
||||
CREATE_VECTOR_TYPEMAP_OUT(unsigned int)
|
||||
CREATE_VECTOR_TYPEMAP_OUT(double)
|
||||
CREATE_VECTOR_TYPEMAP_OUT(std::string)
|
||||
CREATE_VECTOR_TYPEMAP_OUT(IfcGeom::Material)
|
||||
|
||||
Reference in New Issue
Block a user