diff --git a/src/Mod/Arch/ArchWall.py b/src/Mod/Arch/ArchWall.py
index 172a3fec1e..704439aab9 100644
--- a/src/Mod/Arch/ArchWall.py
+++ b/src/Mod/Arch/ArchWall.py
@@ -291,14 +291,17 @@ class _CommandWall:
def addDefault(self,l):
- FreeCADGui.doCommand('base=FreeCAD.ActiveDocument.addObject("Sketcher::SketchObject","WallTrace")')
- FreeCADGui.doCommand('base.Placement = FreeCAD.DraftWorkingPlane.getPlacement()')
- FreeCADGui.doCommand('base.addGeometry(trace)')
+ FreeCADGui.addModule("Draft")
+ if FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch").GetBool("WallSketches",True):
+ FreeCADGui.doCommand('base=FreeCAD.ActiveDocument.addObject("Sketcher::SketchObject","WallTrace")')
+ FreeCADGui.doCommand('base.Placement = FreeCAD.DraftWorkingPlane.getPlacement()')
+ FreeCADGui.doCommand('base.addGeometry(trace)')
+ else:
+ FreeCADGui.doCommand('base=Draft.makeLine(trace)')
FreeCADGui.doCommand('wall = Arch.makeWall(base,width='+str(self.Width)+',height='+str(self.Height)+',align="'+str(self.Align)+'")')
FreeCADGui.doCommand('wall.Normal = FreeCAD.DraftWorkingPlane.axis')
if self.MultiMat:
FreeCADGui.doCommand("wall.Material = FreeCAD.ActiveDocument."+self.MultiMat.Name)
- FreeCADGui.addModule("Draft")
FreeCADGui.doCommand("Draft.autogroup(wall)")
def update(self,point,info):
@@ -714,6 +717,7 @@ class _Wall(ArchComponent.Component):
v.multiply(obj.Length.Value)
p2 = e.Vertexes[0].Point.add(v)
if Draft.getType(obj.Base) == "Wire":
+ #print "modifying p2"
obj.Base.End = p2
elif Draft.getType(obj.Base) == "Sketch":
obj.Base.movePoint(0,2,p2,0)
diff --git a/src/Mod/Arch/Resources/ui/preferences-archdefaults.ui b/src/Mod/Arch/Resources/ui/preferences-archdefaults.ui
index 6833bfad5b..7105e27c94 100644
--- a/src/Mod/Arch/Resources/ui/preferences-archdefaults.ui
+++ b/src/Mod/Arch/Resources/ui/preferences-archdefaults.ui
@@ -6,7 +6,7 @@
0
0
- 510
+ 522
711
@@ -97,6 +97,22 @@
-
+
-
+
+
+ Use sketches
+
+
+ true
+
+
+ WallSketches
+
+
+ Mod/Arch
+
+
+
-
@@ -1023,6 +1039,11 @@
Gui::ColorButton
+
+ Gui::PrefCheckBox
+ QCheckBox
+
+
Gui::PrefDoubleSpinBox
QDoubleSpinBox
diff --git a/src/Mod/Draft/Draft.py b/src/Mod/Draft/Draft.py
index 514c42f31a..e449613c68 100644
--- a/src/Mod/Draft/Draft.py
+++ b/src/Mod/Draft/Draft.py
@@ -912,8 +912,20 @@ def makePolygon(nfaces,radius=1,inscribed=True,placement=None,face=None,support=
FreeCAD.ActiveDocument.recompute()
return obj
-def makeLine(p1,p2):
- '''makeLine(p1,p2): Creates a line between p1 and p2.'''
+def makeLine(p1,p2=None):
+ '''makeLine(p1,p2): Creates a line between p1 and p2.
+ makeLine(LineSegment): Creates a line from a Part.LineSegment
+ makeLine(Shape): Creates a line from first vertex to last vertex of the given shape'''
+ if not p2:
+ if hasattr(p1,"StartPoint") and hasattr(p1,"EndPoint"):
+ p2 = p1.EndPoint
+ p1 = p1.StartPoint
+ elif hasattr(p1,"Vertexes"):
+ p2 = p1.Vertexes[-1].Point
+ p1 = p1.Vertexes[0].Point
+ else:
+ FreeCAD.Console.PrintError("Unable to create a line from the given data\n")
+ return
obj = makeWire([p1,p2])
return obj