Arch: Allow to draw walls by entering length, width and height on the GUI - fixes #2000
This commit is contained in:
parent
a557cd4cc5
commit
fd802bad80
|
@ -161,6 +161,7 @@ class _CommandWall:
|
||||||
def Activated(self):
|
def Activated(self):
|
||||||
self.Align = "Center"
|
self.Align = "Center"
|
||||||
self.Length = None
|
self.Length = None
|
||||||
|
self.lengthValue = 0
|
||||||
self.continueCmd = False
|
self.continueCmd = False
|
||||||
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
||||||
self.Width = p.GetFloat("WallWidth",200)
|
self.Width = p.GetFloat("WallWidth",200)
|
||||||
|
@ -322,12 +323,21 @@ class _CommandWall:
|
||||||
grid.addWidget(label4,4,0,1,1)
|
grid.addWidget(label4,4,0,1,1)
|
||||||
grid.addWidget(value4,4,1,1,1)
|
grid.addWidget(value4,4,1,1,1)
|
||||||
|
|
||||||
|
QtCore.QObject.connect(self.Length,QtCore.SIGNAL("valueChanged(double)"),self.setLength)
|
||||||
QtCore.QObject.connect(value1,QtCore.SIGNAL("valueChanged(double)"),self.setWidth)
|
QtCore.QObject.connect(value1,QtCore.SIGNAL("valueChanged(double)"),self.setWidth)
|
||||||
QtCore.QObject.connect(value2,QtCore.SIGNAL("valueChanged(double)"),self.setHeight)
|
QtCore.QObject.connect(value2,QtCore.SIGNAL("valueChanged(double)"),self.setHeight)
|
||||||
QtCore.QObject.connect(value3,QtCore.SIGNAL("currentIndexChanged(int)"),self.setAlign)
|
QtCore.QObject.connect(value3,QtCore.SIGNAL("currentIndexChanged(int)"),self.setAlign)
|
||||||
QtCore.QObject.connect(value4,QtCore.SIGNAL("stateChanged(int)"),self.setContinue)
|
QtCore.QObject.connect(value4,QtCore.SIGNAL("stateChanged(int)"),self.setContinue)
|
||||||
|
QtCore.QObject.connect(self.Length,QtCore.SIGNAL("returnPressed()"),value1.setFocus)
|
||||||
|
QtCore.QObject.connect(self.Length,QtCore.SIGNAL("returnPressed()"),value1.selectAll)
|
||||||
|
QtCore.QObject.connect(value1,QtCore.SIGNAL("returnPressed()"),value2.setFocus)
|
||||||
|
QtCore.QObject.connect(value1,QtCore.SIGNAL("returnPressed()"),value2.selectAll)
|
||||||
|
QtCore.QObject.connect(value2,QtCore.SIGNAL("returnPressed()"),self.createFromGUI)
|
||||||
return w
|
return w
|
||||||
|
|
||||||
|
def setLength(self,d):
|
||||||
|
self.lengthValue = d
|
||||||
|
|
||||||
def setWidth(self,d):
|
def setWidth(self,d):
|
||||||
self.Width = d
|
self.Width = d
|
||||||
self.tracker.width(d)
|
self.tracker.width(d)
|
||||||
|
@ -344,6 +354,14 @@ class _CommandWall:
|
||||||
if hasattr(FreeCADGui,"draftToolBar"):
|
if hasattr(FreeCADGui,"draftToolBar"):
|
||||||
FreeCADGui.draftToolBar.continueMode = bool(i)
|
FreeCADGui.draftToolBar.continueMode = bool(i)
|
||||||
|
|
||||||
|
def createFromGUI(self):
|
||||||
|
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Wall"))
|
||||||
|
FreeCADGui.addModule("Arch")
|
||||||
|
FreeCADGui.doCommand('Arch.makeWall(length='+str(self.lengthValue)+',width='+str(self.Width)+',height='+str(self.Height)+',align="'+str(self.Align)+'")')
|
||||||
|
FreeCAD.ActiveDocument.commitTransaction()
|
||||||
|
FreeCAD.ActiveDocument.recompute()
|
||||||
|
if hasattr(FreeCADGui,"draftToolBar"):
|
||||||
|
FreeCADGui.draftToolBar.escape()
|
||||||
|
|
||||||
class _CommandMergeWalls:
|
class _CommandMergeWalls:
|
||||||
"the Arch Merge Walls command definition"
|
"the Arch Merge Walls command definition"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user