From 5691866433686a55f7eea222fde5c3b9853adea8 Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Tue, 12 Jun 2012 22:06:35 -0300 Subject: [PATCH] Arch: Fixes in windows --- src/Mod/Arch/ArchWall.py | 24 +++++++++++++++++------- src/Mod/Arch/ArchWindow.py | 6 +++--- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py index e8236af3f..4983d77e7 100644 --- a/src/Mod/Arch/ArchWall.py +++ b/src/Mod/Arch/ArchWall.py @@ -271,7 +271,7 @@ class _Wall(ArchComponent.Component): if prop in ["Base","Height","Width","Align","Additions","Subtractions"]: self.createGeometry(obj) - def getSubVolume(self,base,width,delta=None): + def getSubVolume(self,base,width,plac=None): "returns a subvolume from a base object" import Part max_length = 0 @@ -288,8 +288,8 @@ class _Wall(ArchComponent.Component): v2 = DraftVecUtils.neg(v1) v2 = DraftVecUtils.scale(v1,-2) f = f.extrude(v2) - if delta: - f.translate(delta) + if plac: + f.Placement = plac return f return None @@ -384,12 +384,22 @@ class _Wall(ArchComponent.Component): if base: for app in obj.Additions: - if hasattr(app,"Shape"): + if Draft.getType(app) == "Window": + # window + if app.Base and obj.Width: + f = self.getSubVolume(app.Base,width) + if f: + base = base.cut(f) + elif Draft.isClone(app,"Window"): + if app.Objects[0].Base and width: + f = self.getSubVolume(app.Objects[0].Base,width,app.Placement) + if f: + base = base.cut(f) + elif app.isDerivedFrom("Part::Feature"): if app.Shape: if not app.Shape.isNull(): base = base.fuse(app.Shape) app.ViewObject.hide() #to be removed - for hole in obj.Subtractions: if Draft.getType(hole) == "Window": # window @@ -399,10 +409,10 @@ class _Wall(ArchComponent.Component): base = base.cut(f) elif Draft.isClone(hole,"Window"): if hole.Objects[0].Base and width: - f = self.getSubVolume(hole.Objects[0].Base,width,hole.Placement.Base) + f = self.getSubVolume(hole.Objects[0].Base,width,hole.Placement) if f: base = base.cut(f) - elif hasattr(hole,"Shape"): + elif hole.isDerivedFrom("Part::Feature"): if hole.Shape: if not hole.Shape.isNull(): base = base.cut(hole.Shape) diff --git a/src/Mod/Arch/ArchWindow.py b/src/Mod/Arch/ArchWindow.py index ad9d49369..9c540e7be 100644 --- a/src/Mod/Arch/ArchWindow.py +++ b/src/Mod/Arch/ArchWindow.py @@ -107,9 +107,9 @@ class _CommandWindow: s = obj.Support w = FreeCAD.ActiveDocument.Objects[-1] # last created object FreeCADGui.doCommand("Arch.removeComponents(FreeCAD.ActiveDocument."+w.Name+",host=FreeCAD.ActiveDocument."+s.Name+")") - elif Draft.isClone(w,"Window"): - if w.Objects[0].Inlist: - FreeCADGui.doCommand("Arch.removeComponents(FreeCAD.ActiveDocument."+w.Name+",host=FreeCAD.ActiveDocument."+w.Objects[0].Inlist[0].Name+")") + elif Draft.isClone(obj,"Window"): + if obj.Objects[0].Inlist: + FreeCADGui.doCommand("Arch.removeComponents(FreeCAD.ActiveDocument."+obj.Name+",host=FreeCAD.ActiveDocument."+obj.Objects[0].Inlist[0].Name+")") FreeCAD.ActiveDocument.commitTransaction() class _Window(ArchComponent.Component):