mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-20 06:58:56 +00:00
actualize wrapper code
This commit is contained in:
@@ -75,15 +75,15 @@
|
|||||||
|
|
||||||
%extend IfcGeom::tree {
|
%extend IfcGeom::tree {
|
||||||
|
|
||||||
static IfcEntityList::ptr vector_to_list(const std::vector<IfcUtil::IfcBaseEntity*>& ps) {
|
static aggregate_of_instance::ptr vector_to_list(const std::vector<IfcUtil::IfcBaseEntity*>& ps) {
|
||||||
IfcEntityList::ptr r(new IfcEntityList);
|
aggregate_of_instance::ptr r(new aggregate_of_instance);
|
||||||
for (std::vector<IfcUtil::IfcBaseEntity*>::const_iterator it = ps.begin(); it != ps.end(); ++it) {
|
for (std::vector<IfcUtil::IfcBaseEntity*>::const_iterator it = ps.begin(); it != ps.end(); ++it) {
|
||||||
r->push(*it);
|
r->push(*it);
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcEntityList::ptr select_box(IfcUtil::IfcBaseClass* e, bool completely_within = false, double extend=-1.e-5) const {
|
aggregate_of_instance::ptr select_box(IfcUtil::IfcBaseClass* e, bool completely_within = false, double extend=-1.e-5) const {
|
||||||
if (!e->declaration().is("IfcProduct")) {
|
if (!e->declaration().is("IfcProduct")) {
|
||||||
throw IfcParse::IfcException("Instance should be an IfcProduct");
|
throw IfcParse::IfcException("Instance should be an IfcProduct");
|
||||||
}
|
}
|
||||||
@@ -91,17 +91,17 @@
|
|||||||
return IfcGeom_tree_vector_to_list(ps);
|
return IfcGeom_tree_vector_to_list(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcEntityList::ptr select_box(const gp_Pnt& p) const {
|
aggregate_of_instance::ptr select_box(const gp_Pnt& p) const {
|
||||||
std::vector<IfcUtil::IfcBaseEntity*> ps = $self->select_box(p);
|
std::vector<IfcUtil::IfcBaseEntity*> ps = $self->select_box(p);
|
||||||
return IfcGeom_tree_vector_to_list(ps);
|
return IfcGeom_tree_vector_to_list(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcEntityList::ptr select_box(const Bnd_Box& b, bool completely_within = false) const {
|
aggregate_of_instance::ptr select_box(const Bnd_Box& b, bool completely_within = false) const {
|
||||||
std::vector<IfcUtil::IfcBaseEntity*> ps = $self->select_box(b, completely_within);
|
std::vector<IfcUtil::IfcBaseEntity*> ps = $self->select_box(b, completely_within);
|
||||||
return IfcGeom_tree_vector_to_list(ps);
|
return IfcGeom_tree_vector_to_list(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcEntityList::ptr select(IfcUtil::IfcBaseClass* e, bool completely_within = false, double extend = 0.0) const {
|
aggregate_of_instance::ptr select(IfcUtil::IfcBaseClass* e, bool completely_within = false, double extend = 0.0) const {
|
||||||
if (!e->declaration().is("IfcProduct")) {
|
if (!e->declaration().is("IfcProduct")) {
|
||||||
throw IfcParse::IfcException("Instance should be an IfcProduct");
|
throw IfcParse::IfcException("Instance should be an IfcProduct");
|
||||||
}
|
}
|
||||||
@@ -109,12 +109,12 @@
|
|||||||
return IfcGeom_tree_vector_to_list(ps);
|
return IfcGeom_tree_vector_to_list(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcEntityList::ptr select(const gp_Pnt& p, double extend=0.0) const {
|
aggregate_of_instance::ptr select(const gp_Pnt& p, double extend=0.0) const {
|
||||||
std::vector<IfcUtil::IfcBaseEntity*> ps = $self->select(p, extend);
|
std::vector<IfcUtil::IfcBaseEntity*> ps = $self->select(p, extend);
|
||||||
return IfcGeom_tree_vector_to_list(ps);
|
return IfcGeom_tree_vector_to_list(ps);
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcEntityList::ptr select(const std::string& shape_serialization, bool completely_within = false, double extend = -1.e-5) const {
|
aggregate_of_instance::ptr select(const std::string& shape_serialization, bool completely_within = false, double extend = -1.e-5) const {
|
||||||
std::stringstream stream(shape_serialization);
|
std::stringstream stream(shape_serialization);
|
||||||
BRepTools_ShapeSet shapes;
|
BRepTools_ShapeSet shapes;
|
||||||
shapes.Read(stream);
|
shapes.Read(stream);
|
||||||
@@ -335,7 +335,7 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
|
|||||||
|
|
||||||
typename Schema::IfcProduct* product = (typename Schema::IfcProduct*) instance;
|
typename Schema::IfcProduct* product = (typename Schema::IfcProduct*) instance;
|
||||||
|
|
||||||
if (!representation && !product->hasRepresentation()) {
|
if (!representation && !product->Representation()) {
|
||||||
throw IfcParse::IfcException("Representation is NULL");
|
throw IfcParse::IfcException("Representation is NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -347,17 +347,17 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
|
|||||||
// First, try to find a representation based on the settings
|
// First, try to find a representation based on the settings
|
||||||
for (typename Schema::IfcRepresentation::list::it it = reps->begin(); it != reps->end(); ++it) {
|
for (typename Schema::IfcRepresentation::list::it it = reps->begin(); it != reps->end(); ++it) {
|
||||||
typename Schema::IfcRepresentation* rep = *it;
|
typename Schema::IfcRepresentation* rep = *it;
|
||||||
if (!rep->hasRepresentationIdentifier()) {
|
if (!rep->RepresentationIdentifier()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!settings.get(IfcGeom::IteratorSettings::EXCLUDE_SOLIDS_AND_SURFACES)) {
|
if (!settings.get(IfcGeom::IteratorSettings::EXCLUDE_SOLIDS_AND_SURFACES)) {
|
||||||
if (rep->RepresentationIdentifier() == "Body") {
|
if (*rep->RepresentationIdentifier() == "Body") {
|
||||||
ifc_representation = rep;
|
ifc_representation = rep;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (settings.get(IfcGeom::IteratorSettings::INCLUDE_CURVES)) {
|
if (settings.get(IfcGeom::IteratorSettings::INCLUDE_CURVES)) {
|
||||||
if (rep->RepresentationIdentifier() == "Plan" || rep->RepresentationIdentifier() == "Axis") {
|
if (*rep->RepresentationIdentifier() == "Plan" || *rep->RepresentationIdentifier() == "Axis") {
|
||||||
ifc_representation = rep;
|
ifc_representation = rep;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -372,7 +372,7 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
|
|||||||
typename Schema::IfcRepresentationContext* context = rep->ContextOfItems();
|
typename Schema::IfcRepresentationContext* context = rep->ContextOfItems();
|
||||||
|
|
||||||
// TODO: Remove redundancy with IfcGeomIterator.h
|
// TODO: Remove redundancy with IfcGeomIterator.h
|
||||||
if (context->hasContextType()) {
|
if (context->ContextType()) {
|
||||||
std::set<std::string> context_types;
|
std::set<std::string> context_types;
|
||||||
if (!settings.get(IfcGeom::IteratorSettings::EXCLUDE_SOLIDS_AND_SURFACES)) {
|
if (!settings.get(IfcGeom::IteratorSettings::EXCLUDE_SOLIDS_AND_SURFACES)) {
|
||||||
context_types.insert("model");
|
context_types.insert("model");
|
||||||
@@ -384,7 +384,7 @@ struct ShapeRTTI : public boost::static_visitor<PyObject*>
|
|||||||
context_types.insert("plan");
|
context_types.insert("plan");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string context_type_lc = context->ContextType();
|
std::string context_type_lc = *context->ContextType();
|
||||||
for (std::string::iterator c = context_type_lc.begin(); c != context_type_lc.end(); ++c) {
|
for (std::string::iterator c = context_type_lc.begin(); c != context_type_lc.end(); ++c) {
|
||||||
*c = tolower(*c);
|
*c = tolower(*c);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas
|
|||||||
IfcUtil::IfcBaseClass* by_guid(const std::string& guid) {
|
IfcUtil::IfcBaseClass* by_guid(const std::string& guid) {
|
||||||
return $self->instance_by_guid(guid);
|
return $self->instance_by_guid(guid);
|
||||||
}
|
}
|
||||||
IfcEntityList::ptr get_inverse(IfcUtil::IfcBaseClass* e) {
|
aggregate_of_instance::ptr get_inverse(IfcUtil::IfcBaseClass* e) {
|
||||||
return $self->getInverse(e->data().id(), 0, -1);
|
return $self->getInverse(e->data().id(), 0, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -268,7 +268,7 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IfcEntityList::ptr get_inverse(const std::string& a) {
|
aggregate_of_instance::ptr get_inverse(const std::string& a) {
|
||||||
if ($self->declaration().as_entity()) {
|
if ($self->declaration().as_entity()) {
|
||||||
return ((IfcUtil::IfcBaseEntity*)$self)->get_inverse(a);
|
return ((IfcUtil::IfcBaseEntity*)$self)->get_inverse(a);
|
||||||
} else {
|
} else {
|
||||||
@@ -430,7 +430,7 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setArgumentAsAggregateOfEntityInstance(unsigned int i, IfcEntityList::ptr v) {
|
void setArgumentAsAggregateOfEntityInstance(unsigned int i, aggregate_of_instance::ptr v) {
|
||||||
IfcUtil::ArgumentType arg_type = helper_fn_attribute_type($self, i);
|
IfcUtil::ArgumentType arg_type = helper_fn_attribute_type($self, i);
|
||||||
if (arg_type == IfcUtil::Argument_AGGREGATE_OF_ENTITY_INSTANCE) {
|
if (arg_type == IfcUtil::Argument_AGGREGATE_OF_ENTITY_INSTANCE) {
|
||||||
IfcWrite::IfcWriteArgument* arg = new IfcWrite::IfcWriteArgument();
|
IfcWrite::IfcWriteArgument* arg = new IfcWrite::IfcWriteArgument();
|
||||||
@@ -463,7 +463,7 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setArgumentAsAggregateOfAggregateOfEntityInstance(unsigned int i, IfcEntityListList::ptr v) {
|
void setArgumentAsAggregateOfAggregateOfEntityInstance(unsigned int i, aggregate_of_aggregate_of_instance::ptr v) {
|
||||||
IfcUtil::ArgumentType arg_type = helper_fn_attribute_type($self, i);
|
IfcUtil::ArgumentType arg_type = helper_fn_attribute_type($self, i);
|
||||||
if (arg_type == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE) {
|
if (arg_type == IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE) {
|
||||||
IfcWrite::IfcWriteArgument* arg = new IfcWrite::IfcWriteArgument();
|
IfcWrite::IfcWriteArgument* arg = new IfcWrite::IfcWriteArgument();
|
||||||
@@ -729,7 +729,7 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas
|
|||||||
return get_info_cpp(v);
|
return get_info_cpp(v);
|
||||||
break; }
|
break; }
|
||||||
case IfcUtil::Argument_AGGREGATE_OF_ENTITY_INSTANCE: {
|
case IfcUtil::Argument_AGGREGATE_OF_ENTITY_INSTANCE: {
|
||||||
IfcEntityList::ptr v = arg;
|
aggregate_of_instance::ptr v = arg;
|
||||||
auto r = PyTuple_New(v->size());
|
auto r = PyTuple_New(v->size());
|
||||||
for (unsigned i = 0; i < v->size(); ++i) {
|
for (unsigned i = 0; i < v->size(); ++i) {
|
||||||
PyTuple_SetItem(r, i, get_info_cpp((*v)[i]));
|
PyTuple_SetItem(r, i, get_info_cpp((*v)[i]));
|
||||||
@@ -749,10 +749,10 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas
|
|||||||
return pythonize_vector2(v);
|
return pythonize_vector2(v);
|
||||||
break; }
|
break; }
|
||||||
case IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE: {
|
case IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE: {
|
||||||
IfcEntityListList::ptr vs = arg;
|
aggregate_of_aggregate_of_instance::ptr vs = arg;
|
||||||
auto rs = PyTuple_New(vs->size());
|
auto rs = PyTuple_New(vs->size());
|
||||||
for (auto it = vs->begin(); it != vs->end(); ++it) {
|
for (auto it = vs->begin(); it != vs->end(); ++it) {
|
||||||
IfcEntityList::ptr v_i = arg;
|
aggregate_of_instance::ptr v_i = arg;
|
||||||
auto r = PyTuple_New(v_i->size());
|
auto r = PyTuple_New(v_i->size());
|
||||||
for (unsigned i = 0; i < v_i->size(); ++i) {
|
for (unsigned i = 0; i < v_i->size(); ++i) {
|
||||||
PyTuple_SetItem(r, i, get_info_cpp((*v_i)[i]));
|
PyTuple_SetItem(r, i, get_info_cpp((*v_i)[i]));
|
||||||
|
|||||||
@@ -139,10 +139,10 @@
|
|||||||
return pythonize(bitstring);
|
return pythonize(bitstring);
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* pythonize(const IfcEntityList::ptr& t) {
|
PyObject* pythonize(const aggregate_of_instance::ptr& t) {
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
PyObject* pyobj = PyTuple_New(t->size());
|
PyObject* pyobj = PyTuple_New(t->size());
|
||||||
for (IfcEntityList::it it = t->begin(); it != t->end(); ++it, ++i) {
|
for (aggregate_of_instance::it it = t->begin(); it != t->end(); ++it, ++i) {
|
||||||
PyTuple_SetItem(pyobj, i, pythonize(*it));
|
PyTuple_SetItem(pyobj, i, pythonize(*it));
|
||||||
}
|
}
|
||||||
return pyobj;
|
return pyobj;
|
||||||
@@ -168,10 +168,10 @@
|
|||||||
return pyobj;
|
return pyobj;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject* pythonize(const IfcEntityListList::ptr& t) {
|
PyObject* pythonize(const aggregate_of_aggregate_of_instance::ptr& t) {
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
PyObject* pyobj = PyTuple_New(t->size());
|
PyObject* pyobj = PyTuple_New(t->size());
|
||||||
for (IfcEntityListList::outer_it it = t->begin(); it != t->end(); ++it, ++i) {
|
for (aggregate_of_aggregate_of_instance::outer_it it = t->begin(); it != t->end(); ++it, ++i) {
|
||||||
PyTuple_SetItem(pyobj, i, pythonize_vector(*it));
|
PyTuple_SetItem(pyobj, i, pythonize_vector(*it));
|
||||||
}
|
}
|
||||||
return pyobj;
|
return pyobj;
|
||||||
|
|||||||
@@ -161,9 +161,9 @@ CREATE_VECTOR_TYPEMAP_IN(std::string, STRING, str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(in) IfcEntityList::ptr {
|
%typemap(in) aggregate_of_instance::ptr {
|
||||||
if (PySequence_Check($input)) {
|
if (PySequence_Check($input)) {
|
||||||
$1 = IfcEntityList::ptr(new IfcEntityList());
|
$1 = aggregate_of_instance::ptr(new aggregate_of_instance());
|
||||||
for(Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
|
for(Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
|
||||||
PyObject* element = PySequence_GetItem($input, i);
|
PyObject* element = PySequence_GetItem($input, i);
|
||||||
IfcUtil::IfcBaseClass* inst = cast_pyobject<IfcUtil::IfcBaseClass*>(element);
|
IfcUtil::IfcBaseClass* inst = cast_pyobject<IfcUtil::IfcBaseClass*>(element);
|
||||||
@@ -178,9 +178,9 @@ CREATE_VECTOR_TYPEMAP_IN(std::string, STRING, str)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
%typemap(in) IfcEntityListList::ptr {
|
%typemap(in) aggregate_of_aggregate_of_instance::ptr {
|
||||||
if (PySequence_Check($input)) {
|
if (PySequence_Check($input)) {
|
||||||
$1 = IfcEntityListList::ptr(new IfcEntityListList());
|
$1 = aggregate_of_aggregate_of_instance::ptr(new aggregate_of_aggregate_of_instance());
|
||||||
for(Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
|
for(Py_ssize_t i = 0; i < PySequence_Size($input); ++i) {
|
||||||
PyObject* element = PySequence_GetItem($input, i);
|
PyObject* element = PySequence_GetItem($input, i);
|
||||||
if (PySequence_Check(element)) {
|
if (PySequence_Check(element)) {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
%typemap(out) IfcEntityList::ptr {
|
%typemap(out) aggregate_of_instance::ptr {
|
||||||
const unsigned size = $1 ? $1->size() : 0;
|
const unsigned size = $1 ? $1->size() : 0;
|
||||||
$result = PyTuple_New(size);
|
$result = PyTuple_New(size);
|
||||||
for (unsigned i = 0; i < size; ++i) {
|
for (unsigned i = 0; i < size; ++i) {
|
||||||
@@ -81,7 +81,7 @@
|
|||||||
$result = pythonize(v);
|
$result = pythonize(v);
|
||||||
break; }
|
break; }
|
||||||
case IfcUtil::Argument_AGGREGATE_OF_ENTITY_INSTANCE: {
|
case IfcUtil::Argument_AGGREGATE_OF_ENTITY_INSTANCE: {
|
||||||
IfcEntityList::ptr v = arg;
|
aggregate_of_instance::ptr v = arg;
|
||||||
$result = pythonize(v);
|
$result = pythonize(v);
|
||||||
break; }
|
break; }
|
||||||
case IfcUtil::Argument_AGGREGATE_OF_BINARY: {
|
case IfcUtil::Argument_AGGREGATE_OF_BINARY: {
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
$result = pythonize_vector2(v);
|
$result = pythonize_vector2(v);
|
||||||
break; }
|
break; }
|
||||||
case IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE: {
|
case IfcUtil::Argument_AGGREGATE_OF_AGGREGATE_OF_ENTITY_INSTANCE: {
|
||||||
IfcEntityListList::ptr v = arg;
|
aggregate_of_aggregate_of_instance::ptr v = arg;
|
||||||
$result = pythonize(v);
|
$result = pythonize(v);
|
||||||
break; }
|
break; }
|
||||||
case IfcUtil::Argument_EMPTY_AGGREGATE: {
|
case IfcUtil::Argument_EMPTY_AGGREGATE: {
|
||||||
|
|||||||
Reference in New Issue
Block a user