From 72797fa395aac15e48c36b866d43389bf3bd9c4e Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Thu, 2 Jan 2014 11:53:55 -0200 Subject: [PATCH] Arch: Fixed small bug happening when opening older files --- src/Mod/Arch/ArchStructure.py | 40 ++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 19 deletions(-) diff --git a/src/Mod/Arch/ArchStructure.py b/src/Mod/Arch/ArchStructure.py index b08fda5bd..b0796adcc 100644 --- a/src/Mod/Arch/ArchStructure.py +++ b/src/Mod/Arch/ArchStructure.py @@ -665,26 +665,28 @@ class _Structure(ArchComponent.Component): def onChanged(self,obj,prop): self.hideSubobjects(obj,prop) if prop == "Shape": - if obj.Nodes: - if hasattr(self,"nodes"): - if self.nodes: - if obj.Nodes != self.nodes: - # nodes are set manually: don't touch them + if hasattr(obj,"Nodes"): + # update structural nodes + if obj.Nodes: + if hasattr(self,"nodes"): + if self.nodes: + if obj.Nodes != self.nodes: + # nodes are set manually: don't touch them + return + else: + # nodes haven't been calculated yet, but are set (file load) + # we calculate the nodes now but don't change the property + if hasattr(self,"BaseProfile") and hasattr(self,"ExtrusionVector"): + p1 = self.BaseProfile.CenterOfMass + p2 = p1.add(self.ExtrusionVector) + self.nodes = [p1,p2] return - else: - # nodes haven't been calculated yet, but are set (file load) - # we calculate the nodes now but don't change the property - if hasattr(self,"BaseProfile") and hasattr(self,"ExtrusionVector"): - p1 = self.BaseProfile.CenterOfMass - p2 = p1.add(self.ExtrusionVector) - self.nodes = [p1,p2] - return - if hasattr(self,"BaseProfile") and hasattr(self,"ExtrusionVector"): - p1 = self.BaseProfile.CenterOfMass - p2 = p1.add(self.ExtrusionVector) - self.nodes = [p1,p2] - #print "calculating nodes: ",self.nodes - obj.Nodes = self.nodes + if hasattr(self,"BaseProfile") and hasattr(self,"ExtrusionVector"): + p1 = self.BaseProfile.CenterOfMass + p2 = p1.add(self.ExtrusionVector) + self.nodes = [p1,p2] + #print "calculating nodes: ",self.nodes + obj.Nodes = self.nodes def getAxisPoints(self,obj): "returns the gridpoints of linked axes"