mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-12 02:23:34 +00:00
Fix material unassignment greedy purging bug, and auto assign usages of typed layer / profile sets.
This commit is contained in:
@@ -9,6 +9,15 @@ class Usecase:
|
||||
self.settings[key] = value
|
||||
|
||||
def execute(self):
|
||||
for association in self.settings["product"].HasAssociations:
|
||||
if association.is_a("IfcRelAssociatesMaterial"):
|
||||
self.file.remove(association)
|
||||
for rel in self.settings["product"].HasAssociations:
|
||||
if rel.is_a("IfcRelAssociatesMaterial"):
|
||||
if rel.RelatingMaterial.is_a("IfcMaterialLayerSetUsage") or rel.RelatingMaterial.is_a(
|
||||
"IfcMaterialProfileSetUsage"
|
||||
):
|
||||
self.file.remove(rel.RelatingMaterial)
|
||||
if len(rel.RelatedObjects) == 1:
|
||||
self.file.remove(rel)
|
||||
continue
|
||||
related_objects = set(rel.RelatedObjects)
|
||||
related_objects.remove(self.settings["product"])
|
||||
rel.RelatedObjects = list(related_object)
|
||||
|
||||
Reference in New Issue
Block a user