#1912 apply also on types

This commit is contained in:
Thomas Krijnen
2021-12-02 11:39:28 +01:00
parent c52f851d79
commit dbc6f521fe
2 changed files with 16 additions and 1 deletions
@@ -54,7 +54,7 @@ _method_dict = {}
for nm in ifcopenshell_wrapper.schema_names():
schema = ifcopenshell_wrapper.schema_by_name(nm)
for decl in schema.declarations():
if isinstance(decl, ifcopenshell_wrapper.entity):
if hasattr(decl, "argument_types"):
fq_name = ".".join((nm, decl.name()))
# get type strings as reported by IfcOpenShell C++
+15
View File
@@ -610,6 +610,16 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas
def __repr__(self):
return "<type %s: %r>" % (self.name(), self.declared_type())
%}
std::vector<std::string> argument_types() {
std::vector<std::string> r;
auto at = IfcUtil::Argument_UNKNOWN;
auto pt = $self->declared_type();
if (pt) {
at = IfcUtil::from_parameter_type(pt);
}
r.push_back(IfcUtil::ArgumentTypeToString(at));
return r;
}
}
%extend IfcParse::select_type {
@@ -624,6 +634,11 @@ static IfcUtil::ArgumentType helper_fn_attribute_type(const IfcUtil::IfcBaseClas
def __repr__(self):
return "<enumeration %s: (%s)>" % (self.name(), ", ".join(self.enumeration_items()))
%}
std::vector<std::string> argument_types() {
std::vector<std::string> r;
r.push_back(IfcUtil::ArgumentTypeToString(IfcUtil::Argument_STRING));
return r;
}
}
%extend IfcParse::attribute {