mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 01:41:57 +00:00
owner.remove_role - fix error handling resource level rel (fe1e307)
It's probably was just an overlook in the original commit - it was referring to `settings["organisation"]`, though `"organization"` was never passed, leading to an error. And probably by accident remove_role tests were using the same tests as remove_organization, so the issue went under the radar for a while.
This commit is contained in:
@@ -42,7 +42,8 @@ def remove_role(file: ifcopenshell.file, role: ifcopenshell.entity_instance) ->
|
||||
if inverse.is_a() in ("IfcOrganization", "IfcPerson", "IfcPersonAndOrganization"):
|
||||
if inverse.Roles == (role,):
|
||||
inverse.Roles = None
|
||||
elif inverse.is_a("IfcResourceLevelRelationship") and not inverse.is_a("IfcOrganizationRelationship"):
|
||||
if inverse.RelatedResourceObjects == (organisation,):
|
||||
elif inverse.is_a("IfcResourceLevelRelationship"):
|
||||
# IfcResourceConstraintRelationship or other rels with IfcResourceObjectSelect.
|
||||
if inverse.RelatedResourceObjects == (role,):
|
||||
file.remove(inverse)
|
||||
file.remove(role)
|
||||
|
||||
Reference in New Issue
Block a user