Skip to content

Commit 8c2e122

Browse files
committed
declaration property
1 parent ed88214 commit 8c2e122

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

‎src/ifcopenshell-python/ifcopenshell/entity_instance.py‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,7 @@ def is_entity(self) -> bool:
223223
224224
:return: True if the instance is an entity
225225
"""
226-
schema_name = self.is_a(True).split(".")[0]
227-
decl = ifcopenshell_wrapper.schema_by_name(schema_name).declaration_by_name(self.is_a())
228-
return isinstance(decl, ifcopenshell_wrapper.entity)
226+
return isinstance(self.declaration, ifcopenshell_wrapper.entity)
229227

230228
def compare(self, other, op, reverse=False):
231229
"""Compares with another instance.

‎src/ifcwrap/IfcParseWrapper.i‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -884,6 +884,7 @@ private:
884884

885885
%pythoncode %{
886886
file = property(file_py)
887+
declaration = property(declaration)
887888
%}
888889
}
889890

‎src/ifcwrap/utils/typemaps_out.i‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
$result = SWIG_NewPointerObj(SWIG_as_voidptr($1), declaration_type_to_swig($1), 0);
77
}
88

9+
%typemap(out) const IfcParse::declaration& {
10+
$result = SWIG_NewPointerObj(SWIG_as_voidptr($1), declaration_type_to_swig($1), 0);
11+
}
12+
913
%typemap(out) IfcParse::parameter_type* {
1014
if ($1->as_named_type()) {
1115
$result = SWIG_NewPointerObj(SWIG_as_voidptr($1->as_named_type()), SWIGTYPE_p_IfcParse__named_type, 0);

0 commit comments

Comments
 (0)