mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-30 00:23:14 +00:00
Fix bug where you could unassign a material usage and create an invalid parametric occurrence
This commit is contained in:
@@ -75,7 +75,11 @@ class Usecase:
|
|||||||
for rel in self.settings["product"].HasAssociations:
|
for rel in self.settings["product"].HasAssociations:
|
||||||
if rel.is_a("IfcRelAssociatesMaterial"):
|
if rel.is_a("IfcRelAssociatesMaterial"):
|
||||||
if rel.RelatingMaterial.is_a() in ["IfcMaterialLayerSetUsage", "IfcMaterialProfileSetUsage"]:
|
if rel.RelatingMaterial.is_a() in ["IfcMaterialLayerSetUsage", "IfcMaterialProfileSetUsage"]:
|
||||||
self.file.remove(rel.RelatingMaterial)
|
# Usages cannot be unassigned, as all occurrences of a type
|
||||||
|
# which has a parametric material must use the parametric
|
||||||
|
# material. Instead, unassign the parametric material from
|
||||||
|
# the type.
|
||||||
|
continue
|
||||||
if len(rel.RelatedObjects) == 1:
|
if len(rel.RelatedObjects) == 1:
|
||||||
self.file.remove(rel)
|
self.file.remove(rel)
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user