From b8163a03dc80b64b38744ed1289e8a7bdab0d378 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Wed, 12 Oct 2016 20:20:09 -0300 Subject: [PATCH] Arch: Added NodesOffset property to Structures --- src/Mod/Arch/ArchStructure.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Mod/Arch/ArchStructure.py b/src/Mod/Arch/ArchStructure.py index 658bd844c5..9087edbf0e 100644 --- a/src/Mod/Arch/ArchStructure.py +++ b/src/Mod/Arch/ArchStructure.py @@ -385,6 +385,7 @@ class _Structure(ArchComponent.Component): obj.addProperty("App::PropertyVector","Normal","Arch",QT_TRANSLATE_NOOP("App::Property","The normal extrusion direction of this object (keep (0,0,0) for automatic normal)")) obj.addProperty("App::PropertyVectorList","Nodes","Arch",QT_TRANSLATE_NOOP("App::Property","The structural nodes of this element")) obj.addProperty("App::PropertyString","Profile","Arch",QT_TRANSLATE_NOOP("App::Property","A description of the standard profile this element is based upon")) + obj.addProperty("App::PropertyDistance","NodesOffset","Arch",QT_TRANSLATE_NOOP("App::Property","Offset distance between the centerline and the nodes line")) self.Type = "Structure" obj.Role = Roles @@ -469,10 +470,13 @@ class _Structure(ArchComponent.Component): def onChanged(self,obj,prop): self.hideSubobjects(obj,prop) - if prop in ["Shape","ResetNodes"]: + if prop in ["Shape","ResetNodes","NodesOffset"]: # ResetNodes is not a property but it allows us to use this function to force reset the nodes if hasattr(obj,"Nodes"): # update structural nodes + offset = FreeCAD.Vector() + if hasattr(obj,"NodesOffset"): + offset = FreeCAD.Vector(0,0,obj.NodesOffset.Value) if obj.Nodes and (prop != "ResetNodes"): if hasattr(self,"nodes"): if self.nodes: @@ -487,7 +491,7 @@ class _Structure(ArchComponent.Component): else: nodes = self.getAxis(obj) if nodes: - self.nodes = [v.Point for v in nodes.Vertexes] + self.nodes = [v.Point.add(offset) for v in nodes.Vertexes] return # we calculate and set the nodes if obj.Role in ["Slab"]: @@ -495,7 +499,7 @@ class _Structure(ArchComponent.Component): else: nodes = self.getAxis(obj) if nodes: - self.nodes = [v.Point for v in nodes.Vertexes] + self.nodes = [v.Point.add(offset) for v in nodes.Vertexes] obj.Nodes = self.nodes def getNodeEdges(self,obj):