GUID chunking now implemented when loading either from iterator or H5

This commit is contained in:
Dion Moult
2024-02-23 23:03:05 +11:00
parent 6b82cb4d5d
commit a97678d30e
4 changed files with 99 additions and 4 deletions
+36 -1
View File
@@ -86,6 +86,7 @@
#include "../ifcgeom_schema_agnostic/IfcGeomIterator.h"
#include "../ifcgeom_schema_agnostic/Serialization.h"
#include "../ifcgeom_schema_agnostic/IfcGeomTree.h"
#include "../ifcgeom_schema_agnostic/chunk.h"
#include "../serializers/SvgSerializer.h"
#include "../serializers/WavefrontObjSerializer.h"
@@ -152,6 +153,7 @@
#include "../ifcgeom_schema_agnostic/IfcGeomIterator.h"
#include "../ifcgeom_schema_agnostic/Serialization.h"
#include "../ifcgeom_schema_agnostic/IfcGeomTree.h"
#include "../ifcgeom_schema_agnostic/chunk.h"
#include "../serializers/SvgSerializer.h"
#include "../serializers/WavefrontObjSerializer.h"
@@ -209,6 +211,7 @@
%include "IfcGeomWrapper.i"
%include "IfcParseWrapper.i"
%include "std_vector.i"
%include "../ifcgeom_schema_agnostic/chunk.h"
%include "numpy.i"
%init %{
import_array();
@@ -219,12 +222,14 @@ namespace std {
%template(FloatVector) vector<float>;
%template(IntVector) std::vector<int>;
%template(DoubleVector) std::vector<double>;
%template(StringVector) std::vector<std::string>;
%template(FloatVectorVector) std::vector<std::vector<float>>;
%template(DoubleVectorVector) std::vector<std::vector<double>>;
%template(H5ShapeVector) std::vector<IfcGeom::h5_shape>;
}
%extend IfcGeom::h5_shape {
PyObject* IfcGeom::h5_shape::get_verts() {
PyObject* get_verts() {
npy_intp dims[1] = { (npy_intp)$self->verts.size() };
PyObject* array = PyArray_SimpleNewFromData(1, dims, NPY_FLOAT, (void*)$self->verts.data());
PyArray_CLEARFLAGS((PyArrayObject*)array, NPY_ARRAY_WRITEABLE); // Make the array read-only
@@ -252,3 +257,33 @@ namespace std {
return array;
}
}
%extend IfcGeom::chunk {
PyObject* get_verts() {
npy_intp dims[1] = { (npy_intp)$self->verts.size() };
PyObject* array = PyArray_SimpleNewFromData(1, dims, NPY_DOUBLE, (void*)$self->verts.data());
PyArray_CLEARFLAGS((PyArrayObject*)array, NPY_ARRAY_WRITEABLE); // Make the array read-only
return array;
}
PyObject* get_faces() {
npy_intp dims[1] = { (npy_intp)$self->faces.size() };
PyObject* array = PyArray_SimpleNewFromData(1, dims, NPY_INT, (void*)$self->faces.data());
PyArray_CLEARFLAGS((PyArrayObject*)array, NPY_ARRAY_WRITEABLE); // Make the array read-only
return array;
}
PyObject* get_materials() {
npy_intp dims[1] = { (npy_intp)$self->materials.size() };
PyObject* array = PyArray_SimpleNewFromData(1, dims, NPY_INT, (void*)$self->materials.data());
PyArray_CLEARFLAGS((PyArrayObject*)array, NPY_ARRAY_WRITEABLE); // Make the array read-only
return array;
}
PyObject* get_material_ids() {
npy_intp dims[1] = { (npy_intp)$self->material_ids.size() };
PyObject* array = PyArray_SimpleNewFromData(1, dims, NPY_INT, (void*)$self->material_ids.data());
PyArray_CLEARFLAGS((PyArrayObject*)array, NPY_ARRAY_WRITEABLE); // Make the array read-only
return array;
}
}