mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-17 02:49:12 +00:00
Missing introspection methods in Python
This commit is contained in:
@@ -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<std::string> getAttributeNames() const {
|
||||
if (IfcSchema::Type::IsSimple($self->type())) {
|
||||
return std::vector<std::string>(1, "wrappedValue");
|
||||
}
|
||||
IfcUtil::IfcBaseEntity* self_ = (IfcUtil::IfcBaseEntity*) self;
|
||||
return self_->getAttributeNames();
|
||||
}
|
||||
|
||||
std::vector<std::string> getInverseAttributeNames() const {
|
||||
if (IfcSchema::Type::IsSimple($self->type())) {
|
||||
return std::vector<std::string>(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)));
|
||||
|
||||
Reference in New Issue
Block a user