0000979: Move windows with their host wall

This commit is contained in:
Yorik van Havre 2013-04-19 18:46:24 -03:00
parent 3511a807a3
commit 051dee07f2
2 changed files with 18 additions and 3 deletions

View File

@ -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"

View File

@ -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"