Skip to content

Commit e4f141b

Browse files
committed
Fixes for inverse attributes
1 parent fe17267 commit e4f141b

4 files changed

Lines changed: 216 additions & 201 deletions

File tree

src/ifcexpressparser/rt_implementation.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,14 @@ def __init__(self, mapping):
8888
for name, type in mapping.schema.entities.items():
8989
if type.inverse:
9090
for attr in type.inverse.elements:
91-
print (attr)
91+
related_entity = mapping.schema.entities[attr.entity]
92+
related_attrs = [a['name'] for a in mapping.get_assignable_arguments(related_entity, include_derived=True)]
93+
9294
inverse_implementations.append(templates.inverse_implementation % {
9395
'type' : name,
9496
'name' : attr.name,
9597
'related_type' : attr.entity,
96-
'index' : [i for i, a in enumerate(mapping.schema.entities[attr.entity].attributes) if a.name == attr.attribute][0]
98+
'index' : related_attrs.index(attr.attribute)
9799
})
98100

99101
self.str = templates.rt_implementation % {

0 commit comments

Comments
 (0)