Don't copy _paths when cloning Cell or Material

This commit is contained in:
Paul Romano 2017-05-26 07:52:39 -05:00
parent 897db1389d
commit 81fcd19ec6
2 changed files with 18 additions and 1 deletions

View file

@ -527,8 +527,16 @@ class Cell(object):
# If no nemoize'd clone exists, instantiate one
if self not in memo:
# Temporarily remove paths
paths = self.paths
self._paths = None
clone = deepcopy(self)
clone.id = None
# Restore paths on original instance
self._paths = paths
if self.region is not None:
clone.region = self.region.clone(memo)
if self.fill is not None:
@ -542,7 +550,7 @@ class Cell(object):
memo[self] = clone
return memo[self]
def create_xml_subelement(self, xml_element):
element = ET.Element("cell")
element.set("id", str(self.id))

View file

@ -820,9 +820,18 @@ class Material(object):
# If no nemoize'd clone exists, instantiate one
if self not in memo:
# Temporarily remove paths -- this is done so that when the clone is
# made, it doesn't create a copy of the paths (which are specific to
# an instance)
paths = self.paths
self._paths = None
clone = deepcopy(self)
clone.id = None
# Restore paths on original instance
self._paths = paths
# Memoize the clone
memo[self] = clone