Arch: Joining underlying sketches of connecting walls is now optional (preferences settings)

This commit is contained in:
Yorik van Havre 2013-02-15 13:20:26 -02:00
parent b2be64ad23
commit b1efe94651
2 changed files with 47 additions and 33 deletions

View File

@ -110,7 +110,8 @@ class _CommandWall:
self.Height = 1
self.Align = "Center"
self.continueCmd = False
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
self.JOIN_WALLS = p.GetBool("joinWallSketches")
sel = FreeCADGui.Selection.getSelection()
done = False
self.existing = []
@ -145,7 +146,6 @@ class _CommandWall:
FreeCADGui.Snapper.getPoint(last=self.points[0],callback=self.getPoint,movecallback=self.update,extradlg=self.taskbox())
elif len(self.points) == 2:
import Part
add = False
l = Part.Line(self.points[0],self.points[1])
self.tracker.finalize()
FreeCAD.ActiveDocument.openTransaction(str(translate("Arch","Create Wall")))
@ -153,19 +153,25 @@ class _CommandWall:
FreeCADGui.doCommand('import Part')
FreeCADGui.doCommand('trace=Part.Line(FreeCAD.'+str(l.StartPoint)+',FreeCAD.'+str(l.EndPoint)+')')
if not self.existing:
# no existing wall snapped, just add a default wall
self.addDefault(l)
else:
w = joinWalls(self.existing)
if w:
if areSameWallTypes([w,self]):
FreeCADGui.doCommand('FreeCAD.ActiveDocument.'+w.Name+'.Base.addGeometry(trace)')
if self.JOIN_WALLS:
# join existing subwalls first if possible, then add the new one
w = joinWalls(self.existing)
if w:
if areSameWallTypes([w,self]):
FreeCADGui.doCommand('FreeCAD.ActiveDocument.'+w.Name+'.Base.addGeometry(trace)')
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+')')
else:
self.addDefault(l)
add = True
else:
# add new wall as addition to the first existing one
self.addDefault(l)
if add:
FreeCADGui.doCommand('Arch.addComponents(FreeCAD.ActiveDocument.'+FreeCAD.ActiveDocument.Objects[-1].Name+',FreeCAD.ActiveDocument.'+w.Name+')')
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:

View File

@ -26,33 +26,41 @@ class ArchWorkbench(Workbench):
Icon = """
/* XPM */
static char * arch_xpm[] = {
"16 16 9 1",
"16 16 17 1",
" c None",
". c #543016",
"+ c #6D2F08",
"@ c #954109",
"# c #874C24",
"$ c #AE6331",
"% c #C86423",
"& c #FD7C26",
"* c #F5924F",
". c #373936",
"+ c #464845",
"@ c #545553",
"# c #626461",
"$ c #6B6D6A",
"% c #727471",
"& c #7E807D",
"* c #8A8C89",
"= c #949693",
"- c #A1A3A0",
"; c #ADAFAC",
"> c #BEC1BD",
", c #C9CBC8",
"' c #D9DCD8",
") c #E4E6E3",
"! c #FDFFFC",
" ",
" ",
" # ",
" ***$# ",
" .*******. ",
" *##$****#+ ",
" #**%&&##$#@@ ",
".$**%&&&&+@@+ ",
"@&@#$$%&&@@+.. ",
"@&&&%#.#$#+..#$.",
" %&&&&+%#.$**$@+",
" @%&+&&&$##@@+",
" @.&&&&&@@@ ",
" @%&&@@ ",
" @+ ",
" "};
"""
" & ",
" >)'-% ",
" #,))))),@ ",
" >%*-))))*# ",
" $')>!)**>%*% ",
"@=')>!!!!$==# ",
"=!=**;'!!&=$++ ",
"=!!!)*@&-%#@#&-.",
" ,!!!!#>&#=,'=%@",
" ;)!#!!!-*$&=@",
" *@!!!!!$=* ",
" =>!!$& ",
" -+ ",
" "};"""
MenuText = "Arch"
ToolTip = "Architecture workbench"