diff --git a/src/Mod/Arch/ArchCommands.py b/src/Mod/Arch/ArchCommands.py
index 975501effa..414bfbf176 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()
@@ -202,17 +202,19 @@ def makeComponent(baseobj=None,name="Component",delete=False):
def fixDAG(obj):
'''fixDAG(object): Fixes non-DAG problems in windows and rebars
by removing supports and external geometry from underlying sketches'''
- if Draft.getType(obj) in ["Window","Rebar"]:
- if obj.Base:
- if hasattr(obj.Base,"Support"):
- if obj.Base.Support:
- FreeCAD.Console.PrintMessage(translate("Arch","removing sketch support to avoid cross-referencing"))
- obj.Base.Support = None
- if hasattr(obj.Base,"ExternalGeometry"):
- if obj.Base.ExternalGeometry:
- for g in obj.Base.ExternalGeometry:
- obj.Base.delExternal(0)
- FreeCAD.Console.PrintMessage(translate("Arch","removing sketch external reference to avoid cross-referencing"))
+ p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
+ if p.GetBool("archRemoveExternal",False):
+ if Draft.getType(obj) in ["Window","Rebar"]:
+ if obj.Base:
+ if hasattr(obj.Base,"Support"):
+ if obj.Base.Support:
+ FreeCAD.Console.PrintMessage(translate("Arch","removing sketch support to avoid cross-referencing"))
+ obj.Base.Support = None
+ if hasattr(obj.Base,"ExternalGeometry"):
+ if obj.Base.ExternalGeometry:
+ for g in obj.Base.ExternalGeometry:
+ obj.Base.delExternal(0)
+ FreeCAD.Console.PrintMessage(translate("Arch","removing sketch external reference to avoid cross-referencing"))
def copyProperties(obj1,obj2):
'''copyProperties(obj1,obj2): Copies properties values from obj1 to obj2,
diff --git a/src/Mod/Arch/ArchRebar.py b/src/Mod/Arch/ArchRebar.py
index f60592e8e3..b6611f8d48 100644
--- a/src/Mod/Arch/ArchRebar.py
+++ b/src/Mod/Arch/ArchRebar.py
@@ -56,11 +56,17 @@ def makeRebar(baseobj=None,sketch=None,diameter=None,amount=1,offset=None,name="
obj.Base = sketch
if FreeCAD.GuiUp:
sketch.ViewObject.hide()
- import Arch
- host = getattr(Arch,"make"+Draft.getType(baseobj))(baseobj)
- a = host.Armatures
- a.append(obj)
- host.Armatures = a
+ p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
+ if p.GetBool("archRemoveExternal",False):
+ a = baseobj.Armatures
+ a.append(obj)
+ baseobj.Armatures = a
+ else:
+ import Arch
+ host = getattr(Arch,"make"+Draft.getType(baseobj))(baseobj)
+ a = host.Armatures
+ a.append(obj)
+ host.Armatures = a
if diameter:
obj.Diameter = diameter
else:
@@ -72,7 +78,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 25562a1696..fbe0ac35ef 100644
--- a/src/Mod/Arch/ArchWindow.py
+++ b/src/Mod/Arch/ArchWindow.py
@@ -391,6 +391,7 @@ class _CommandWindow:
self.Thickness = p.GetFloat("WindowThickness",50)
self.Width = p.GetFloat("WindowWidth",1000)
self.Height = p.GetFloat("WindowHeight",1000)
+ self.RemoveExternal = p.GetBool("archRemoveExternal",False)
self.Preset = 0
self.Sill = 0
self.baseFace = None
@@ -431,13 +432,19 @@ class _CommandWindow:
FreeCADGui.addModule("Arch")
FreeCADGui.doCommand("win = Arch.makeWindow(FreeCAD.ActiveDocument."+obj.Name+")")
if host:
- # 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)")
+ if self.RemoveExternal:
+ FreeCADGui.doCommand("Arch.removeComponents(win,host=FreeCAD.ActiveDocument."+host.Name+")")
+ else:
+ # 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("host=Arch.make"+Draft.getType(sibling)+"(FreeCAD.ActiveDocument."+sibling.Name+")")
- FreeCADGui.doCommand("Arch.removeComponents(win,host)")
+ if self.RemoveExternal:
+ FreeCADGui.doCommand("Arch.removeComponents(win,host=FreeCAD.ActiveDocument."+sibling.Name+")")
+ else:
+ 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
@@ -477,12 +484,18 @@ class _CommandWindow:
FreeCADGui.doCommand("win = Arch.makeWindowPreset(\"" + WindowPresets[self.Preset] + "\"," + wp + "placement=pl)")
if obj:
if Draft.getType(obj) in AllowedHosts:
- FreeCADGui.doCommand("host=Arch.make"+Draft.getType(obj)+"(FreeCAD.ActiveDocument."+obj.Name+")")
- FreeCADGui.doCommand("Arch.removeComponents(win,host)")
+ if self.RemoveExternal:
+ FreeCADGui.doCommand("Arch.removeComponents(win,host=FreeCAD.ActiveDocument."+obj.Name+")")
+ else:
+ 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("host=Arch.make"+Draft.getType(sibling)+"(FreeCAD.ActiveDocument."+sibling.Name+")")
- FreeCADGui.doCommand("Arch.removeComponents(win,host)")
+ if self.RemoveExternal:
+ FreeCADGui.doCommand("Arch.removeComponents(win,host=FreeCAD.ActiveDocument."+sibling.Name+")")
+ else:
+ 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
diff --git a/src/Mod/Arch/Resources/ui/preferences-arch.ui b/src/Mod/Arch/Resources/ui/preferences-arch.ui
index eb5618693f..0dc32ae340 100644
--- a/src/Mod/Arch/Resources/ui/preferences-arch.ui
+++ b/src/Mod/Arch/Resources/ui/preferences-arch.ui
@@ -52,7 +52,7 @@
-
- Walls drawing
+ Object creation
-
@@ -95,6 +95,26 @@
+ -
+
+
-
+
+
+ Two possible strategies to avoid circular dependencies: Create one more object (unchecked) or remove external geometry of base sketch (checked)
+
+
+ Remove external geometry of base sketches when needed
+
+
+ archRemoveExternal
+
+
+ Mod/Arch
+
+
+
+
+