mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-12 06:32:09 +00:00
Revert "Fix bug where IFC data types were hashed as the same value in RecycleNonRootedElements IfcPatch recipe"
This reverts commit 3be8e4f1ce.
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
# IfcPatch - IFC patching utiliy
|
# IfcPatch - IFC patching utiliy
|
||||||
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
|
# Copyright (C) 2020, 2021 Dion Moult <dion@thinkmoult.com>
|
||||||
#
|
#
|
||||||
@@ -19,7 +20,6 @@
|
|||||||
from collections import deque
|
from collections import deque
|
||||||
import ifcopenshell.util.element
|
import ifcopenshell.util.element
|
||||||
|
|
||||||
|
|
||||||
class Patcher:
|
class Patcher:
|
||||||
def __init__(self, src, file, logger, args=None):
|
def __init__(self, src, file, logger, args=None):
|
||||||
self.src = src
|
self.src = src
|
||||||
@@ -31,16 +31,9 @@ class Patcher:
|
|||||||
deleted = []
|
deleted = []
|
||||||
hashes = {}
|
hashes = {}
|
||||||
for element in self.file:
|
for element in self.file:
|
||||||
if element.is_a("IfcRoot"):
|
if element.is_a('IfcRoot'):
|
||||||
continue
|
continue
|
||||||
h = hash(
|
h = hash(tuple(element))
|
||||||
tuple(
|
|
||||||
[
|
|
||||||
a.wrappedValue if isinstance(a, ifcopenshell.entity_instance) and not a.id() else a
|
|
||||||
for a in element
|
|
||||||
]
|
|
||||||
)
|
|
||||||
)
|
|
||||||
if h in hashes:
|
if h in hashes:
|
||||||
for inverse in self.file.get_inverse(element):
|
for inverse in self.file.get_inverse(element):
|
||||||
ifcopenshell.util.element.replace_attribute(inverse, element, hashes[h])
|
ifcopenshell.util.element.replace_attribute(inverse, element, hashes[h])
|
||||||
@@ -49,13 +42,13 @@ class Patcher:
|
|||||||
hashes[h] = element
|
hashes[h] = element
|
||||||
deleted.sort()
|
deleted.sort()
|
||||||
deleted_q = deque(deleted)
|
deleted_q = deque(deleted)
|
||||||
new = ""
|
new = ''
|
||||||
for line in self.file.wrapped_data.to_string().split("\n"):
|
for line in self.file.wrapped_data.to_string().split('\n'):
|
||||||
try:
|
try:
|
||||||
if int(line.split("=")[0][1:]) != deleted_q[0]:
|
if int(line.split('=')[0][1:]) != deleted_q[0]:
|
||||||
new += line + "\n"
|
new += (line + '\n')
|
||||||
else:
|
else:
|
||||||
deleted_q.popleft()
|
deleted_q.popleft()
|
||||||
except:
|
except:
|
||||||
new += line + "\n"
|
new += (line + '\n')
|
||||||
self.file = new
|
self.file = new
|
||||||
|
|||||||
Reference in New Issue
Block a user