From b1efe94651178671af089c71cf40ea526b91c1bb Mon Sep 17 00:00:00 2001 From: Yorik van Havre Date: Fri, 15 Feb 2013 13:20:26 -0200 Subject: [PATCH] Arch: Joining underlying sketches of connecting walls is now optional (preferences settings) --- src/Mod/Arch/ArchWall.py | 24 ++++++++++------- src/Mod/Arch/InitGui.py | 56 +++++++++++++++++++++++----------------- 2 files changed, 47 insertions(+), 33 deletions(-) diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py index 9369e251e..4dd3380ae 100644 --- a/src/Mod/Arch/ArchWall.py +++ b/src/Mod/Arch/ArchWall.py @@ -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: diff --git a/src/Mod/Arch/InitGui.py b/src/Mod/Arch/InitGui.py index f6bde4e28..9538fe810 100644 --- a/src/Mod/Arch/InitGui.py +++ b/src/Mod/Arch/InitGui.py @@ -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"