diff --git a/src/ifcopenshell-python/ifcopenshell/entity_instance.py b/src/ifcopenshell-python/ifcopenshell/entity_instance.py index 55aece5469..ec3fab2283 100644 --- a/src/ifcopenshell-python/ifcopenshell/entity_instance.py +++ b/src/ifcopenshell-python/ifcopenshell/entity_instance.py @@ -120,8 +120,8 @@ class entity_instance(object): def __dir__(self): return sorted(set(itertools.chain( dir(type(self)), - self.wrapped_data.get_attribute_names(), - self.wrapped_data.get_inverse_attribute_names() + map(str, self.wrapped_data.get_attribute_names()), + map(str, self.wrapped_data.get_inverse_attribute_names()) ))) def get_info(self, include_identifier=True, recursive=False): diff --git a/src/ifcwrap/IfcParseWrapper.i b/src/ifcwrap/IfcParseWrapper.i index 96aafd6237..514530c4aa 100644 --- a/src/ifcwrap/IfcParseWrapper.i +++ b/src/ifcwrap/IfcParseWrapper.i @@ -109,9 +109,26 @@ private: // id() is defined on IfcBaseEntity and not on IfcBaseClass, in order // to expose it to the Python wrapper it is simply duplicated here. + // Same applies to the two methods reimplemented below. int id() const { return $self->entity->id(); } + + std::vector getAttributeNames() const { + if (IfcSchema::Type::IsSimple($self->type())) { + return std::vector(1, "wrappedValue"); + } + IfcUtil::IfcBaseEntity* self_ = (IfcUtil::IfcBaseEntity*) self; + return self_->getAttributeNames(); + } + + std::vector getInverseAttributeNames() const { + if (IfcSchema::Type::IsSimple($self->type())) { + return std::vector(0); + } + IfcUtil::IfcBaseEntity* self_ = (IfcUtil::IfcBaseEntity*) self; + return self_->getInverseAttributeNames(); + } bool is_a(const std::string& s) { return self->is(IfcSchema::Type::FromString(boost::to_upper_copy(s)));