Skip to content

Commit 375bd7a

Browse files
committed
IfcOpenShell#1912 apply also on types
1 parent c5e4436 commit 375bd7a

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/ifcopenshell-python/ifcopenshell/entity_instance.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def set_derived_atribute(*args):
5454
for nm in ifcopenshell_wrapper.schema_names():
5555
schema = ifcopenshell_wrapper.schema_by_name(nm)
5656
for decl in schema.declarations():
57-
if isinstance(decl, ifcopenshell_wrapper.entity):
57+
if hasattr(decl, "argument_types"):
5858
fq_name = ".".join((nm, decl.name()))
5959

6060
# get type strings as reported by IfcOpenShell C++

src/ifcwrap/IfcParseWrapper.i

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,16 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas
610610
def __repr__(self):
611611
return "<type %s: %r>" % (self.name(), self.declared_type())
612612
%}
613+
std::vector<std::string> argument_types() {
614+
std::vector<std::string> r;
615+
auto at = IfcUtil::Argument_UNKNOWN;
616+
auto pt = $self->declared_type();
617+
if (pt) {
618+
at = IfcUtil::from_parameter_type(pt);
619+
}
620+
r.push_back(IfcUtil::ArgumentTypeToString(at));
621+
return r;
622+
}
613623
}
614624

615625
%extend IfcParse::select_type {
@@ -624,6 +634,11 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas
624634
def __repr__(self):
625635
return "<enumeration %s: (%s)>" % (self.name(), ", ".join(self.enumeration_items()))
626636
%}
637+
std::vector<std::string> argument_types() {
638+
std::vector<std::string> r;
639+
r.push_back(IfcUtil::ArgumentTypeToString(IfcUtil::Argument_STRING));
640+
return r;
641+
}
627642
}
628643

629644
%extend IfcParse::attribute {

0 commit comments

Comments
 (0)