mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-29 03:37:21 +00:00
Fix #7080. Potential bug with merging styles that didn't replace elements of the same class.
This commit is contained in:
@@ -44,11 +44,12 @@ class Patcher(ifcpatch.BasePatcher):
|
|||||||
uniques = {}
|
uniques = {}
|
||||||
i = 0
|
i = 0
|
||||||
for element in self.file.by_type(ifc_class):
|
for element in self.file.by_type(ifc_class):
|
||||||
data = "-".join([str(a) for a in element])
|
ifc_class = element.is_a()
|
||||||
if unique := uniques.get(data, None):
|
key = "-".join([str(a) for a in element])
|
||||||
|
if unique := uniques.get(ifc_class, {}).get(key, None):
|
||||||
ifcopenshell.util.element.replace_element(element, unique)
|
ifcopenshell.util.element.replace_element(element, unique)
|
||||||
self.file.remove(element)
|
self.file.remove(element)
|
||||||
i += 1
|
i += 1
|
||||||
else:
|
else:
|
||||||
uniques[data] = element
|
uniques.setdefault(ifc_class, {})[key] = element
|
||||||
print(f"Replaced {i} {ifc_class}")
|
print(f"Replaced {i} {ifc_class}")
|
||||||
|
|||||||
Reference in New Issue
Block a user