diff --git a/src/Mod/Path/Gui/Resources/preferences/PathJob.ui b/src/Mod/Path/Gui/Resources/preferences/PathJob.ui
index 5659614d31..3450979155 100644
--- a/src/Mod/Path/Gui/Resources/preferences/PathJob.ui
+++ b/src/Mod/Path/Gui/Resources/preferences/PathJob.ui
@@ -7,7 +7,7 @@
0
0
440
- 515
+ 669
@@ -25,7 +25,7 @@
0
0
422
- 404
+ 558
@@ -133,7 +133,7 @@
0
0
422
- 404
+ 558
@@ -502,6 +502,88 @@
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Placement
+
+
+ true
+
+
+ false
+
+
+
-
+
+
+ -
+
+
+ Position
+
+
+
+ -
+
+
+ Axis
+
+
+
+ -
+
+
+ -
+
+
+ Angle
+
+
+
+ -
+
+
+ -
+
+
+ -
+
+
+ QAbstractSpinBox::NoButtons
+
+
+
+ -
+
+
+ QAbstractSpinBox::NoButtons
+
+
+
+ -
+
+
+ QAbstractSpinBox::NoButtons
+
+
+
+
+
+
@@ -513,7 +595,7 @@
20
- 8
+ 13
@@ -558,6 +640,14 @@
stockBoxLength
stockBoxWidth
stockBoxHeight
+ stockPlacementGroup
+ stockAngle
+ stockAxisX
+ stockAxisY
+ stockAxisZ
+ stockPositionX
+ stockPositionY
+ stockPositionZ
diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py
index 54251134ec..fa5fb7d48e 100644
--- a/src/Mod/Path/PathScripts/PathJob.py
+++ b/src/Mod/Path/PathScripts/PathJob.py
@@ -41,7 +41,6 @@ if False:
PathLog.trackModule(PathLog.thisModule())
else:
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
- PathLog.trackModule(PathLog.thisModule())
"""Path Job object and FreeCAD command"""
diff --git a/src/Mod/Path/PathScripts/PathPreferencesPathJob.py b/src/Mod/Path/PathScripts/PathPreferencesPathJob.py
index 80d12ebd51..47c534eddd 100644
--- a/src/Mod/Path/PathScripts/PathPreferencesPathJob.py
+++ b/src/Mod/Path/PathScripts/PathPreferencesPathJob.py
@@ -85,6 +85,17 @@ class JobPreferencesPage:
attrs['ypos'] = FreeCAD.Units.Quantity(self.form.stockExtYpos.text()).UserString
attrs['zneg'] = FreeCAD.Units.Quantity(self.form.stockExtZneg.text()).UserString
attrs['zpos'] = FreeCAD.Units.Quantity(self.form.stockExtZpos.text()).UserString
+ if self.form.stockPlacementGroup.isChecked():
+ angle = FreeCAD.Units.Quantity(self.form.stockAngle.text()).Value
+ axis = FreeCAD.Vector(self.form.stockAxisX.value(), self.form.stockAxisY.value(), self.form.stockAxisZ.value())
+ rot = FreeCAD.Rotation(axis, angle)
+ attrs['rotX'] = rot.Q[0]
+ attrs['rotY'] = rot.Q[1]
+ attrs['rotZ'] = rot.Q[2]
+ attrs['rotW'] = rot.Q[3]
+ attrs['posX'] = FreeCAD.Units.Quantity(self.form.stockPositionX.text()).Value
+ attrs['posY'] = FreeCAD.Units.Quantity(self.form.stockPositionY.text()).Value
+ attrs['posZ'] = FreeCAD.Units.Quantity(self.form.stockPositionZ.text()).Value
PathPreferences.setDefaultStockTemplate(json.dumps(attrs))
else:
PathPreferences.setDefaultStockTemplate('')
@@ -184,6 +195,30 @@ class JobPreferencesPage:
self.form.stockCylinderRadius.setText(attrs.get('radius', '5 mm'))
self.form.stockCylinderHeight.setText(attrs.get('height', '10 mm'))
+ posX = attrs.get('posX')
+ posY = attrs.get('posY')
+ posZ = attrs.get('posZ')
+ rotX = attrs.get('rotX')
+ rotY = attrs.get('rotY')
+ rotZ = attrs.get('rotZ')
+ rotW = attrs.get('rotW')
+ if posX is not None and posY is not None and posZ is not None and rotX is not None and rotY is not None and rotZ is not None and rotW is not None:
+ pos = FreeCAD.Vector(float(posX), float(posY), float(posZ))
+ rot = FreeCAD.Rotation(float(rotX), float(rotY), float(rotZ), float(rotW))
+ placement = FreeCAD.Placement(pos, rot)
+ self.form.stockPlacementGroup.setChecked(True)
+ else:
+ placement = FreeCAD.Placement()
+ self.form.stockPlacementGroup.setChecked(False)
+
+ self.form.stockAngle.setText(FreeCAD.Units.Quantity("%f rad" % placement.Rotation.Angle).UserString)
+ self.form.stockAxisX.setValue(placement.Rotation.Axis.x)
+ self.form.stockAxisY.setValue(placement.Rotation.Axis.y)
+ self.form.stockAxisZ.setValue(placement.Rotation.Axis.z)
+ self.form.stockPositionX.setText(FreeCAD.Units.Quantity(placement.Base.x, FreeCAD.Units.Length).UserString)
+ self.form.stockPositionY.setText(FreeCAD.Units.Quantity(placement.Base.y, FreeCAD.Units.Length).UserString)
+ self.form.stockPositionZ.setText(FreeCAD.Units.Quantity(placement.Base.z, FreeCAD.Units.Length).UserString)
+
self.setupStock(index)
self.form.stock.currentIndexChanged.connect(self.setupStock)