Arch: Add a pref option to disable auto wall-merge

This commit is contained in:
Yorik van Havre 2014-01-14 17:02:16 -02:00
parent e352e169da
commit 9fdf3f64ad
3 changed files with 39 additions and 7 deletions

View File

@ -147,7 +147,8 @@ class _CommandWall:
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
self.Width = p.GetFloat("WallWidth",200)
self.Height = p.GetFloat("WallHeight",3000)
self.JOIN_WALLS = p.GetBool("joinWallSketches")
self.JOIN_WALLS_SKETCHES = p.GetBool("joinWallSketches",False)
self.AUTOJOIN = p.GetBool("autoJoinWalls",True)
sel = FreeCADGui.Selection.getSelectionEx()
done = False
self.existing = []
@ -208,7 +209,7 @@ class _CommandWall:
# no existing wall snapped, just add a default wall
self.addDefault(l)
else:
if self.JOIN_WALLS:
if self.JOIN_WALLS_SKETCHES:
# join existing subwalls first if possible, then add the new one
w = joinWalls(self.existing)
if w:
@ -217,13 +218,15 @@ class _CommandWall:
else:
# if not possible, add new wall as addition to the existing one
self.addDefault(l)
FreeCADGui.doCommand('Arch.addComponents(FreeCAD.ActiveDocument.'+FreeCAD.ActiveDocument.Objects[-1].Name+',FreeCAD.ActiveDocument.'+w.Name+')')
if self.AUTOJOIN:
FreeCADGui.doCommand('Arch.addComponents(FreeCAD.ActiveDocument.'+FreeCAD.ActiveDocument.Objects[-1].Name+',FreeCAD.ActiveDocument.'+w.Name+')')
else:
self.addDefault(l)
else:
# add new wall as addition to the first existing one
self.addDefault(l)
FreeCADGui.doCommand('Arch.addComponents(FreeCAD.ActiveDocument.'+FreeCAD.ActiveDocument.Objects[-1].Name+',FreeCAD.ActiveDocument.'+self.existing[0].Name+')')
if self.AUTOJOIN:
FreeCADGui.doCommand('Arch.addComponents(FreeCAD.ActiveDocument.'+FreeCAD.ActiveDocument.Objects[-1].Name+',FreeCAD.ActiveDocument.'+self.existing[0].Name+')')
FreeCAD.ActiveDocument.commitTransaction()
FreeCAD.ActiveDocument.recompute()
if self.continueCmd:

File diff suppressed because one or more lines are too long

View File

@ -504,6 +504,35 @@
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox_4">
<property name="title">
<string>Walls drawing</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="Gui::PrefCheckBox" name="gui::prefcheckbox_5">
<property name="text">
<string>Auto-join walls</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="prefEntry" stdset="0">
<cstring>autoJoinWalls</cstring>
</property>
<property name="prefPath" stdset="0">
<cstring>Mod/Arch</cstring>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>