From 051dee07f201df8c4cdfb0c74648fc6cdfe3d99c Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Fri, 19 Apr 2013 18:46:24 -0300 Subject: [PATCH] 0000979: Move windows with their host wall --- src/Mod/Arch/ArchComponent.py | 8 +++++--- src/Mod/Arch/ArchWall.py | 13 +++++++++++++ 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/src/Mod/Arch/ArchComponent.py b/src/Mod/Arch/ArchComponent.py index e614a2db2..aa5a30064 100644 --- a/src/Mod/Arch/ArchComponent.py +++ b/src/Mod/Arch/ArchComponent.py @@ -25,7 +25,7 @@ __title__="FreeCAD Arch Component" __author__ = "Yorik van Havre" __url__ = "http://free-cad.sourceforge.net" -import FreeCAD,FreeCADGui +import FreeCAD,FreeCADGui,Draft from PyQt4 import QtGui,QtCore from DraftTools import translate @@ -101,7 +101,8 @@ def removeFromComponent(compobject,subobject): l = compobject.Subtractions l.append(subobject) compobject.Subtractions = l - subobject.ViewObject.hide() + if Draft.getType(subobject) != "Window": + subobject.ViewObject.hide() class ComponentTaskPanel: @@ -306,7 +307,8 @@ class Component: if prop in ["Additions","Subtractions"]: if hasattr(obj,prop): for o in getattr(obj,prop): - o.ViewObject.hide() + if Draft.getType(o) != "Window": + o.ViewObject.hide() def processSubShapes(self,obj,base): "Adds additions and subtractions to a base shape" diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py index e4a7f4bb7..91d3f26f6 100644 --- a/src/Mod/Arch/ArchWall.py +++ b/src/Mod/Arch/ArchWall.py @@ -335,6 +335,19 @@ class _Wall(ArchComponent.Component): self.hideSubobjects(obj,prop) if prop in ["Base","Height","Width","Align","Additions","Subtractions"]: self.createGeometry(obj) + # propagate movements to children windows + if prop == "Placement": + if obj.Shape: + if not obj.Shape.isNull(): + vo = obj.Shape.Placement.Base + vn = obj.Placement.Base + if not DraftVecUtils.equals(vo,vn): + delta = vn.sub(vo) + for o in obj.OutList: + if (Draft.getType(o) == "Window") or Draft.isClone(o,"Window"): + o.Placement.move(delta) + + def getDefaultValues(self,obj): "returns normal,width,height values from this wall"