From 5b750aabe369ca89d039b24c8e92a636ae4fc6ce Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Fri, 18 Dec 2015 22:11:53 -0200 Subject: [PATCH] Arch: Creating windows no longer removes external refs from base sketches - fixes #2326 --- src/Mod/Arch/ArchCommands.py | 2 +- src/Mod/Arch/ArchRebar.py | 8 +++++--- src/Mod/Arch/ArchWindow.py | 13 +++++++++---- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py index cd3f2bddcb5c..a9baa4596f16 100644 --- a/src/Mod/Arch/ArchCommands.py +++ b/src/Mod/Arch/ArchCommands.py @@ -140,7 +140,7 @@ def removeComponents(objectsList,host=None): for o in objectsList: if not o in s: s.append(o) - fixDAG(o) + #fixDAG(o) if FreeCAD.GuiUp: if not Draft.getType(o) in ["Window","Roof"]: o.ViewObject.hide() diff --git a/src/Mod/Arch/ArchRebar.py b/src/Mod/Arch/ArchRebar.py index 5a6c76f7c915..f60592e8e3eb 100644 --- a/src/Mod/Arch/ArchRebar.py +++ b/src/Mod/Arch/ArchRebar.py @@ -56,9 +56,11 @@ def makeRebar(baseobj=None,sketch=None,diameter=None,amount=1,offset=None,name=" obj.Base = sketch if FreeCAD.GuiUp: sketch.ViewObject.hide() - a = baseobj.Armatures + import Arch + host = getattr(Arch,"make"+Draft.getType(baseobj))(baseobj) + a = host.Armatures a.append(obj) - baseobj.Armatures = a + host.Armatures = a if diameter: obj.Diameter = diameter else: @@ -70,7 +72,7 @@ def makeRebar(baseobj=None,sketch=None,diameter=None,amount=1,offset=None,name=" else: obj.OffsetStart = p.GetFloat("RebarOffset",30) obj.OffsetEnd = p.GetFloat("RebarOffset",30) - ArchCommands.fixDAG(obj) + #ArchCommands.fixDAG(obj) return obj diff --git a/src/Mod/Arch/ArchWindow.py b/src/Mod/Arch/ArchWindow.py index 1d642d2f6d27..25562a169653 100644 --- a/src/Mod/Arch/ArchWindow.py +++ b/src/Mod/Arch/ArchWindow.py @@ -431,10 +431,13 @@ def Activated(self): FreeCADGui.addModule("Arch") FreeCADGui.doCommand("win = Arch.makeWindow(FreeCAD.ActiveDocument."+obj.Name+")") if host: - FreeCADGui.doCommand("Arch.removeComponents(win,host=FreeCAD.ActiveDocument."+host.Name+")") + # make a new object to avoid circular references + FreeCADGui.doCommand("host=Arch.make"+Draft.getType(host)+"(FreeCAD.ActiveDocument."+host.Name+")") + FreeCADGui.doCommand("Arch.removeComponents(win,host)") siblings = host.Proxy.getSiblings(host) for sibling in siblings: - FreeCADGui.doCommand("Arch.removeComponents(win,host=FreeCAD.ActiveDocument."+sibling.Name+")") + FreeCADGui.doCommand("host=Arch.make"+Draft.getType(sibling)+"(FreeCAD.ActiveDocument."+sibling.Name+")") + FreeCADGui.doCommand("Arch.removeComponents(win,host)") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() return @@ -474,10 +477,12 @@ def getPoint(self,point=None,obj=None): FreeCADGui.doCommand("win = Arch.makeWindowPreset(\"" + WindowPresets[self.Preset] + "\"," + wp + "placement=pl)") if obj: if Draft.getType(obj) in AllowedHosts: - FreeCADGui.doCommand("Arch.removeComponents(win,host=FreeCAD.ActiveDocument."+obj.Name+")") + FreeCADGui.doCommand("host=Arch.make"+Draft.getType(obj)+"(FreeCAD.ActiveDocument."+obj.Name+")") + FreeCADGui.doCommand("Arch.removeComponents(win,host)") siblings = obj.Proxy.getSiblings(obj) for sibling in siblings: - FreeCADGui.doCommand("Arch.removeComponents(win,host=FreeCAD.ActiveDocument."+sibling.Name+")") + FreeCADGui.doCommand("host=Arch.make"+Draft.getType(sibling)+"(FreeCAD.ActiveDocument."+sibling.Name+")") + FreeCADGui.doCommand("Arch.removeComponents(win,host)") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() return