From 21b116649e4a1d729b7e17e2865b1bbb7b84be8d Mon Sep 17 00:00:00 2001 From: Sebastian Stetter Date: Sun, 8 Jan 2017 14:56:57 +0100 Subject: [PATCH] PATH: fix for 2805 changed TaskPanels to use unit conversions via FreeCAD.Units commented out references to segLen since it si used nowhere --- .../Path/Gui/Resources/panels/ContourEdit.ui | 62 +++++++-------- .../Path/Gui/Resources/panels/MillFaceEdit.ui | 75 +++++++++++-------- .../Path/Gui/Resources/panels/PocketEdit.ui | 25 ++++--- .../Gui/Resources/panels/ProfileEdgesEdit.ui | 44 +++++------ .../Path/Gui/Resources/panels/ProfileEdit.ui | 36 ++++----- .../Path/Gui/Resources/panels/SurfaceEdit.ui | 30 +++----- src/Mod/Path/PathScripts/PathContour.py | 42 +++++------ src/Mod/Path/PathScripts/PathDrilling.py | 24 +++--- src/Mod/Path/PathScripts/PathEngrave.py | 12 +-- src/Mod/Path/PathScripts/PathMillFace.py | 35 +++++---- src/Mod/Path/PathScripts/PathPocket.py | 30 ++++---- src/Mod/Path/PathScripts/PathProfile.py | 43 +++++------ src/Mod/Path/PathScripts/PathProfileEdges.py | 43 +++++------ src/Mod/Path/PathScripts/PathSurface.py | 33 ++++---- 14 files changed, 266 insertions(+), 268 deletions(-) diff --git a/src/Mod/Path/Gui/Resources/panels/ContourEdit.ui b/src/Mod/Path/Gui/Resources/panels/ContourEdit.ui index d5f3c8c82..22af2b4d9 100644 --- a/src/Mod/Path/Gui/Resources/panels/ContourEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/ContourEdit.ui @@ -31,7 +31,7 @@ 0 0 334 - 313 + 327 @@ -98,7 +98,7 @@ 0 0 334 - 313 + 327 @@ -148,7 +148,7 @@ 0 0 334 - 313 + 327 @@ -206,7 +206,7 @@ 0 0 334 - 313 + 327 @@ -277,30 +277,6 @@ - - - - - - - Plunge Angle - - - - - - - Roll Radius - - - - - - - Segment Length - - - @@ -309,7 +285,14 @@ - + + + 0.000000000000000 + + + mm + + @@ -321,13 +304,24 @@ - - - - 0.000000000000000 + + + + Roll Radius + + + + + + Plunge Angle + + + + + - mm + diff --git a/src/Mod/Path/Gui/Resources/panels/MillFaceEdit.ui b/src/Mod/Path/Gui/Resources/panels/MillFaceEdit.ui index 2795ac19c..76aff59f5 100644 --- a/src/Mod/Path/Gui/Resources/panels/MillFaceEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/MillFaceEdit.ui @@ -6,7 +6,7 @@ 0 0 - 374 + 340 453 @@ -23,7 +23,7 @@ - 0 + 1 @@ -33,8 +33,8 @@ 0 0 - 340 - 277 + 322 + 259 @@ -111,8 +111,8 @@ 0 0 - 356 - 124 + 322 + 108 @@ -123,6 +123,9 @@ Depths + + QFormLayout::ExpandingFieldsGrow + @@ -165,19 +168,6 @@ - - - - 3 - - - 0.100000000000000 - - - 1.000000000000000 - - - @@ -185,6 +175,16 @@ + + + + 0 mm + + + mm + + + @@ -192,8 +192,8 @@ 0 0 - 356 - 95 + 322 + 99 @@ -242,8 +242,8 @@ 0 0 - 356 - 296 + 305 + 191 @@ -309,6 +309,13 @@ QFrame::Raised + + + + + + + @@ -316,16 +323,6 @@ - - - - ZigZag Angle - - - - - - @@ -333,6 +330,13 @@ + + + + ZigZag Angle + + + @@ -409,6 +413,11 @@ QLineEdit
Gui/InputField.h
+ + Gui::QuantitySpinBox + QWidget +
Gui/QuantitySpinBox.h
+
diff --git a/src/Mod/Path/Gui/Resources/panels/PocketEdit.ui b/src/Mod/Path/Gui/Resources/panels/PocketEdit.ui index c4ebd835a..208ac7735 100644 --- a/src/Mod/Path/Gui/Resources/panels/PocketEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/PocketEdit.ui @@ -40,7 +40,7 @@ 0 0 334 - 321 + 343 @@ -118,7 +118,7 @@ 0 0 334 - 321 + 343 @@ -196,7 +196,7 @@ 0 0 334 - 321 + 343 @@ -246,7 +246,7 @@ 0 0 334 - 321 + 343 @@ -260,7 +260,7 @@ 0 0 334 - 321 + 343 @@ -299,6 +299,9 @@ QFrame::Raised + + QFormLayout::ExpandingFieldsGrow + @@ -313,9 +316,6 @@ - - - @@ -323,6 +323,13 @@ + + + + + + +
@@ -334,7 +341,7 @@ 0 0 334 - 321 + 343 diff --git a/src/Mod/Path/Gui/Resources/panels/ProfileEdgesEdit.ui b/src/Mod/Path/Gui/Resources/panels/ProfileEdgesEdit.ui index 200acefd7..b3744ee7c 100644 --- a/src/Mod/Path/Gui/Resources/panels/ProfileEdgesEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/ProfileEdgesEdit.ui @@ -33,8 +33,8 @@ 0 0 - 334 - 313 + 212 + 273 @@ -111,8 +111,8 @@ 0 0 - 334 - 313 + 109 + 82 @@ -181,8 +181,8 @@ 0 0 - 334 - 313 + 144 + 56 @@ -231,8 +231,8 @@ 0 0 - 334 - 313 + 160 + 111 @@ -288,9 +288,9 @@ 0 - -15 - 320 - 338 + 0 + 334 + 330 @@ -334,8 +334,12 @@ - - + + + + + + @@ -348,29 +352,19 @@ - - - Segment Length - - - - Roll Radius - + Plunge Angle - - - @@ -378,7 +372,7 @@ - + 0.000000000000000 diff --git a/src/Mod/Path/Gui/Resources/panels/ProfileEdit.ui b/src/Mod/Path/Gui/Resources/panels/ProfileEdit.ui index 74293db72..587bcee8d 100644 --- a/src/Mod/Path/Gui/Resources/panels/ProfileEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/ProfileEdit.ui @@ -34,7 +34,7 @@ 0 0 381 - 346 + 363 @@ -112,7 +112,7 @@ 0 0 381 - 346 + 363 @@ -179,7 +179,7 @@ 0 0 381 - 346 + 363 @@ -229,7 +229,7 @@ 0 0 381 - 346 + 363 @@ -285,9 +285,9 @@ 0 - -28 - 367 - 384 + 0 + 381 + 363 @@ -345,7 +345,7 @@ - + Plunge Angle @@ -360,22 +360,12 @@ - - - Segment Length - - - - Roll Radius - - - @@ -387,9 +377,6 @@ - - - 0.000000000000000 @@ -399,6 +386,13 @@ + + + + + + + diff --git a/src/Mod/Path/Gui/Resources/panels/SurfaceEdit.ui b/src/Mod/Path/Gui/Resources/panels/SurfaceEdit.ui index ccb092a4b..d78ed18e0 100644 --- a/src/Mod/Path/Gui/Resources/panels/SurfaceEdit.ui +++ b/src/Mod/Path/Gui/Resources/panels/SurfaceEdit.ui @@ -23,7 +23,7 @@ - 0 + 1 @@ -34,7 +34,7 @@ 0 0 334 - 387 + 395 @@ -112,7 +112,7 @@ 0 0 334 - 387 + 395 @@ -165,19 +165,6 @@ - - - - 3 - - - 0.100000000000000 - - - 1.000000000000000 - - - @@ -185,6 +172,13 @@ + + + + mm + + + @@ -193,7 +187,7 @@ 0 0 334 - 387 + 395 @@ -243,7 +237,7 @@ 0 0 334 - 387 + 195 diff --git a/src/Mod/Path/PathScripts/PathContour.py b/src/Mod/Path/PathScripts/PathContour.py index f113e720f..c02a9d2d4 100644 --- a/src/Mod/Path/PathScripts/PathContour.py +++ b/src/Mod/Path/PathScripts/PathContour.py @@ -94,7 +94,7 @@ class ObjectContour: obj.addProperty("App::PropertyDistance", "RollRadius", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property","Radius at start and end")) obj.addProperty("App::PropertyDistance", "OffsetExtra", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property","Extra value to stay away from final Contour- good for roughing toolpath")) - obj.addProperty("App::PropertyLength", "SegLen", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property","Tesselation value for tool paths made from beziers, bsplines, and ellipses")) + #obj.addProperty("App::PropertyLength", "SegLen", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property","Tesselation value for tool paths made from beziers, bsplines, and ellipses")) obj.addProperty("App::PropertyAngle", "PlungeAngle", "Contour", QtCore.QT_TRANSLATE_NOOP("App::Property","Plunge angle with which the tool enters the work piece. Straight down is 90 degrees, if set small enough or zero the tool will descent exactly one layer depth down per turn")) obj.addProperty("App::PropertyVectorList", "locs", "Tags", QtCore.QT_TRANSLATE_NOOP("App::Property","List of holding tag locations")) @@ -439,23 +439,23 @@ class TaskPanel: def getFields(self): if self.obj: if hasattr(self.obj, "StartDepth"): - self.obj.StartDepth = self.form.startDepth.text() + self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value if hasattr(self.obj, "FinalDepth"): - self.obj.FinalDepth = self.form.finalDepth.text() + self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value if hasattr(self.obj, "SafeHeight"): - self.obj.SafeHeight = self.form.safeHeight.text() + self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value if hasattr(self.obj, "ClearanceHeight"): - self.obj.ClearanceHeight = self.form.clearanceHeight.text() + self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value if hasattr(self.obj, "StepDown"): - self.obj.StepDown = self.form.stepDown.text() + self.obj.StepDown = FreeCAD.Units.Quantity(self.form.stepDown.text()).Value if hasattr(self.obj, "OffsetExtra"): - self.obj.OffsetExtra = self.form.extraOffset.text() - if hasattr(self.obj, "SegLen"): - self.obj.SegLen = self.form.segLen.value() + self.obj.OffsetExtra = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value + #if hasattr(self.obj, "SegLen"): + # self.obj.SegLen = self.form.segLen.value() if hasattr(self.obj, "RollRadius"): - self.obj.RollRadius = self.form.rollRadius.text() + self.obj.RollRadius = FreeCAD.Units.Quantity(self.form.rollRadius.text()).Value if hasattr(self.obj, "PlungeAngle"): - self.obj.PlungeAngle = str(self.form.plungeAngle.value()) + self.obj.PlungeAngle = FreeCAD.Units.Quantity(self.form.plungeAngle.text()).Value if hasattr(self.obj, "UseComp"): self.obj.UseComp = self.form.useCompensation.isChecked() if hasattr(self.obj, "UseStartPoint"): @@ -467,15 +467,15 @@ class TaskPanel: self.obj.Proxy.execute(self.obj) def setFields(self): - self.form.startDepth.setText(str(self.obj.StartDepth.Value)) - self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) - self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) - self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value)) - self.form.stepDown.setText(str(self.obj.StepDown.Value)) - self.form.extraOffset.setText(str(self.obj.OffsetExtra.Value)) - self.form.segLen.setValue(self.obj.SegLen.Value) - self.form.rollRadius.setText(str(self.obj.RollRadius.Value)) - self.form.plungeAngle.setValue(self.obj.PlungeAngle.Value) + self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString) + self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString) + self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString) + self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString) + self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown.Value, FreeCAD.Units.Length).UserString) + self.form.extraOffset.setText(FreeCAD.Units.Quantity(self.obj.OffsetExtra.Value, FreeCAD.Units.Length).UserString) + #self.form.segLen.setValue(self.obj.SegLen.Value) + self.form.rollRadius.setText(FreeCAD.Units.Quantity(self.obj.RollRadius.Value, FreeCAD.Units.Length).UserString) + self.form.plungeAngle.setText(FreeCAD.Units.Quantity(self.obj.PlungeAngle.Value, FreeCAD.Units.Angle).UserString) self.form.useCompensation.setChecked(self.obj.UseComp) self.form.useStartPoint.setChecked(self.obj.UseStartPoint) self.form.useEndPoint.setChecked(self.obj.UseEndPoint) @@ -609,7 +609,7 @@ class TaskPanel: self.form.useStartPoint.clicked.connect(self.getFields) self.form.useEndPoint.clicked.connect(self.getFields) self.form.extraOffset.editingFinished.connect(self.getFields) - self.form.segLen.editingFinished.connect(self.getFields) + #self.form.segLen.editingFinished.connect(self.getFields) self.form.rollRadius.editingFinished.connect(self.getFields) # Tag Form diff --git a/src/Mod/Path/PathScripts/PathDrilling.py b/src/Mod/Path/PathScripts/PathDrilling.py index 2cd9b79e8..345c9c4e1 100644 --- a/src/Mod/Path/PathScripts/PathDrilling.py +++ b/src/Mod/Path/PathScripts/PathDrilling.py @@ -400,27 +400,27 @@ class TaskPanel: def getFields(self): if self.obj: if hasattr(self.obj, "StartDepth"): - self.obj.StartDepth = self.form.startDepth.text() + self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value if hasattr(self.obj, "FinalDepth"): - self.obj.FinalDepth = self.form.finalDepth.text() + self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value if hasattr(self.obj, "PeckDepth"): - self.obj.PeckDepth = self.form.peckDepth.text() + self.obj.PeckDepth = FreeCAD.Units.Quantity(self.form.peckDepth.text()).Value if hasattr(self.obj, "SafeHeight"): - self.obj.SafeHeight = self.form.safeHeight.text() + self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value if hasattr(self.obj, "ClearanceHeight"): - self.obj.ClearanceHeight = self.form.clearanceHeight.text() + self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value if hasattr(self.obj, "RetractHeight"): - self.obj.RetractHeight = self.form.retractHeight.text() + self.obj.RetractHeight = FreeCAD.Units.Quantity(self.form.retractHeight.text()).Value self.obj.Proxy.execute(self.obj) def setFields(self): - self.form.startDepth.setText(str(self.obj.StartDepth.Value)) - self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) - self.form.peckDepth.setText(str(self.obj.PeckDepth.Value)) - self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) - self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value)) - self.form.retractHeight.setText(str(self.obj.RetractHeight.Value)) + self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString) + self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString) + self.form.peckDepth.setText(FreeCAD.Units.Quantity(self.obj.PeckDepth.Value, FreeCAD.Units.Length).UserString) + self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString) + self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString) + self.form.retractHeight.setText(FreeCAD.Units.Quantity(self.obj.RetractHeight.Value, FreeCAD.Units.Length).UserString) self.form.baseList.clear() for i in self.obj.Base: diff --git a/src/Mod/Path/PathScripts/PathEngrave.py b/src/Mod/Path/PathScripts/PathEngrave.py index 638788da8..96ca2e3f2 100644 --- a/src/Mod/Path/PathScripts/PathEngrave.py +++ b/src/Mod/Path/PathScripts/PathEngrave.py @@ -320,18 +320,18 @@ class TaskPanel: def getFields(self): if self.obj: if hasattr(self.obj, "FinalDepth"): - self.obj.FinalDepth = self.form.finalDepth.text() + self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value if hasattr(self.obj, "SafeHeight"): - self.obj.SafeHeight = self.form.safeHeight.text() + self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value if hasattr(self.obj, "ClearanceHeight"): - self.obj.ClearanceHeight = self.form.clearanceHeight.text() + self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value self.obj.Proxy.execute(self.obj) def setFields(self): - self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) - self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) - self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value)) + self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString) + self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString) + self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString) self.form.baseList.clear() for i in self.obj.Base: diff --git a/src/Mod/Path/PathScripts/PathMillFace.py b/src/Mod/Path/PathScripts/PathMillFace.py index d27c1adf5..13747fe43 100644 --- a/src/Mod/Path/PathScripts/PathMillFace.py +++ b/src/Mod/Path/PathScripts/PathMillFace.py @@ -420,19 +420,20 @@ class TaskPanel: def getFields(self): if self.obj: if hasattr(self.obj, "StartDepth"): - self.obj.StartDepth = self.form.startDepth.text() + self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value if hasattr(self.obj, "FinalDepth"): - self.obj.FinalDepth = self.form.finalDepth.text() + self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value if hasattr(self.obj, "FinishDepth"): - self.obj.FinishDepth = self.form.finishDepth.text() + self.obj.FinishDepth = FreeCAD.Units.Quantity(self.form.finishDepth.text()).Value if hasattr(self.obj, "SafeHeight"): - self.obj.SafeHeight = self.form.safeHeight.text() + self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value if hasattr(self.obj, "ClearanceHeight"): - self.obj.ClearanceHeight = self.form.clearanceHeight.text() + self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value if hasattr(self.obj, "StepDown"): - self.obj.StepDown = self.form.stepDown.value() + self.obj.StepDown = FreeCAD.Units.Quantity(self.form.stepDown.text()).Value if hasattr(self.obj, "PassExtension"): - self.obj.PassExtension = self.form.extraOffset.value() + self.obj.PassExtension = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value + # if hasattr(self.obj, "UseStartPoint"): # self.obj.UseStartPoint = self.form.useStartPoint.isChecked() if hasattr(self.obj, "CutMode"): @@ -442,7 +443,9 @@ class TaskPanel: if hasattr(self.obj, "ZigUnidirectional"): self.obj.ZigUnidirectional = self.form.zigZagUnidirectional.isChecked() if hasattr(self.obj, "ZigZagAngle"): - self.obj.ZigZagAngle = self.form.zigZagAngle.value() + self.obj.ZigZagAngle = FreeCAD.Units.Quantity(self.form.zigZagAngle.text()).Value +# if hasattr(self.obj, "ZigZagAngle"): +# self.obj.ZigZagAngle = self.form.zigZagAngle.value() if hasattr(self.obj, "StepOver"): self.obj.StepOver = self.form.stepOverPercent.value() if hasattr(self.obj, "BoundaryShape"): @@ -451,16 +454,18 @@ class TaskPanel: self.obj.Proxy.execute(self.obj) def setFields(self): - self.form.startDepth.setText(str(self.obj.StartDepth.Value)) - self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) - self.form.finishDepth.setText(str(self.obj.FinishDepth.Value)) - self.form.stepDown.setValue(self.obj.StepDown) - self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) - self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value)) + self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString) + self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString) + self.form.finishDepth.setText(FreeCAD.Units.Quantity(self.obj.FinishDepth.Value, FreeCAD.Units.Length).UserString) + self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown, FreeCAD.Units.Length).UserString) + self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString) + self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString) + self.form.stepOverPercent.setValue(self.obj.StepOver) self.form.useZigZag.setChecked(self.obj.UseZigZag) self.form.zigZagUnidirectional.setChecked(self.obj.ZigUnidirectional) - self.form.zigZagAngle.setValue(self.obj.ZigZagAngle) + self.form.zigZagAngle.setValue(FreeCAD.Units.Quantity(self.obj.ZigZagAngle, FreeCAD.Units.Angle)) +# self.form.zigZagAngle.setValue(self.obj.ZigZagAngle) #self.form.useStartPoint.setChecked(self.obj.UseStartPoint) self.form.extraOffset.setValue(self.obj.PassExtension.Value) diff --git a/src/Mod/Path/PathScripts/PathPocket.py b/src/Mod/Path/PathScripts/PathPocket.py index 6689e178e..441a72790 100644 --- a/src/Mod/Path/PathScripts/PathPocket.py +++ b/src/Mod/Path/PathScripts/PathPocket.py @@ -338,7 +338,7 @@ class ObjectPocket: else: output += "G3" output += " X" + fmt(point.x) + " Y" + fmt(point.y) + " Z" + fmt(vpos) - output += " I" + fmt(relcenter.x) + " J" + fmt(relcenter.y) + " K" + fmt(relcenter.z) + " F" + fmt(self.horizFeed) + output += " I" + fmt(relcenter.x) + " J" + fmt(relcenter.y) + " K" + fmt(relcenter.z) + " F" + fmt(self.horizFeed) output += "\n" last = point else: @@ -545,17 +545,17 @@ class TaskPanel: def getFields(self): if self.obj: if hasattr(self.obj, "StartDepth"): - self.obj.StartDepth = self.form.startDepth.text() + self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value if hasattr(self.obj, "FinalDepth"): - self.obj.FinalDepth = self.form.finalDepth.text() + self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value if hasattr(self.obj, "SafeHeight"): - self.obj.SafeHeight = self.form.safeHeight.text() + self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value if hasattr(self.obj, "ClearanceHeight"): - self.obj.ClearanceHeight = self.form.clearanceHeight.text() + self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value if hasattr(self.obj, "StepDown"): - self.obj.StepDown = self.form.stepDown.text() + self.obj.StepDown = FreeCAD.Units.Quantity(self.form.stepDown.text()).Value if hasattr(self.obj, "MaterialAllowance"): - self.obj.MaterialAllowance = self.form.extraOffset.text() + self.obj.MaterialAllowance = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value if hasattr(self.obj, "UseStartPoint"): self.obj.UseStartPoint = self.form.useStartPoint.isChecked() if hasattr(self.obj, "Algorithm"): @@ -567,23 +567,23 @@ class TaskPanel: if hasattr(self.obj, "ZigUnidirectional"): self.obj.ZigUnidirectional = self.form.zigZagUnidirectional.isChecked() if hasattr(self.obj, "ZigZagAngle"): - self.obj.ZigZagAngle = self.form.zigZagAngle.value() + self.obj.ZigZagAngle = FreeCAD.Units.Quantity(self.form.zigZagAngle.text()).Value if hasattr(self.obj, "StepOver"): self.obj.StepOver = self.form.stepOverPercent.value() self.obj.Proxy.execute(self.obj) def setFields(self): - self.form.startDepth.setText(str(self.obj.StartDepth.Value)) - self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) - self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) - self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value)) - self.form.stepDown.setText(str(self.obj.StepDown)) - self.form.extraOffset.setText(str(self.obj.MaterialAllowance.Value)) + self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString) + self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString) + self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString) + self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString) + self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown.Value, FreeCAD.Units.Length).UserString) + self.form.extraOffset.setText(FreeCAD.Units.Quantity(self.obj.MaterialAllowance, FreeCAD.Units.Length).UserString) self.form.useStartPoint.setChecked(self.obj.UseStartPoint) self.form.useZigZag.setChecked(self.obj.UseZigZag) self.form.zigZagUnidirectional.setChecked(self.obj.ZigUnidirectional) - self.form.zigZagAngle.setValue(self.obj.ZigZagAngle) + self.form.zigZagAngle.setText(FreeCAD.Units.Quantity(self.obj.ZigZagAngle, FreeCAD.Units.Angle).UserString) self.form.stepOverPercent.setValue(self.obj.StepOver) index = self.form.algorithmSelect.findText(self.obj.Algorithm, QtCore.Qt.MatchFixedString) diff --git a/src/Mod/Path/PathScripts/PathProfile.py b/src/Mod/Path/PathScripts/PathProfile.py index 2ac149e8b..a9348693a 100644 --- a/src/Mod/Path/PathScripts/PathProfile.py +++ b/src/Mod/Path/PathScripts/PathProfile.py @@ -94,7 +94,7 @@ class ObjectProfile: obj.addProperty("App::PropertyDistance", "RollRadius", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Radius at start and end")) obj.addProperty("App::PropertyDistance", "OffsetExtra", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Extra value to stay away from final profile- good for roughing toolpath")) - obj.addProperty("App::PropertyLength", "SegLen", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Tesselation value for tool paths made from beziers, bsplines, and ellipses")) +# obj.addProperty("App::PropertyLength", "SegLen", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Tesselation value for tool paths made from beziers, bsplines, and ellipses")) obj.addProperty("App::PropertyAngle", "PlungeAngle", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Plunge angle with which the tool enters the work piece. Straight down is 90 degrees, if set small enough or zero the tool will descent exactly one layer depth down per turn")) obj.addProperty("App::PropertyBool", "processHoles", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Profile holes as well as the outline")) obj.addProperty("App::PropertyBool", "processPerimeter", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Profile the outline")) @@ -486,24 +486,25 @@ class TaskPanel: def getFields(self): if self.obj: + if hasattr(self.obj, "StartDepth"): - self.obj.StartDepth = self.form.startDepth.text() + self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value if hasattr(self.obj, "FinalDepth"): - self.obj.FinalDepth = self.form.finalDepth.text() + self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value if hasattr(self.obj, "SafeHeight"): - self.obj.SafeHeight = self.form.safeHeight.text() + self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value if hasattr(self.obj, "ClearanceHeight"): - self.obj.ClearanceHeight = self.form.clearanceHeight.text() + self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value if hasattr(self.obj, "StepDown"): - self.obj.StepDown = self.form.stepDown.text() + self.obj.StepDown = FreeCAD.Units.Quantity(self.form.stepDown.text()).Value if hasattr(self.obj, "OffsetExtra"): - self.obj.OffsetExtra = self.form.extraOffset.text() - if hasattr(self.obj, "SegLen"): - self.obj.SegLen = self.form.segLen.value() + self.obj.OffsetExtra = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value +# if hasattr(self.obj, "SegLen"): +# self.obj.SegLen = self.form.segLen.value() if hasattr(self.obj, "RollRadius"): - self.obj.RollRadius = self.form.rollRadius.text() + self.obj.RollRadius = FreeCAD.Units.Quantity(self.form.rollRadius.text()).Value if hasattr(self.obj, "PlungeAngle"): - self.obj.PlungeAngle = str(self.form.plungeAngle.value()) + self.obj.PlungeAngle = FreeCAD.Units.Quantity(self.form.plungeAngle.text()).Value if hasattr(self.obj, "UseComp"): self.obj.UseComp = self.form.useCompensation.isChecked() if hasattr(self.obj, "UseStartPoint"): @@ -521,15 +522,15 @@ class TaskPanel: self.obj.Proxy.execute(self.obj) def setFields(self): - self.form.startDepth.setText(str(self.obj.StartDepth.Value)) - self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) - self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) - self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value)) - self.form.stepDown.setText(str(self.obj.StepDown)) - self.form.extraOffset.setText(str(self.obj.OffsetExtra.Value)) - self.form.segLen.setValue(self.obj.SegLen.Value) - self.form.rollRadius.setText(str(self.obj.RollRadius.Value)) - self.form.plungeAngle.setValue(self.obj.PlungeAngle.Value) + self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString) + self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString) + self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString) + self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString) + self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown.Value, FreeCAD.Units.Length).UserString) + self.form.extraOffset.setText(FreeCAD.Units.Quantity(self.obj.OffsetExtra.Value, FreeCAD.Units.Length).UserString) +# self.form.segLen.setValue(self.obj.SegLen.Value) + self.form.rollRadius.setText(FreeCAD.Units.Quantity(self.obj.RollRadius.Value, FreeCAD.Units.Length).UserString) + self.form.plungeAngle.setText(FreeCAD.Units.Quantity(self.obj.PlungeAngle.Value, FreeCAD.Units.Angle).UserString) self.form.useCompensation.setChecked(self.obj.UseComp) self.form.useStartPoint.setChecked(self.obj.UseStartPoint) self.form.useEndPoint.setChecked(self.obj.UseEndPoint) @@ -753,7 +754,7 @@ class TaskPanel: self.form.useStartPoint.clicked.connect(self.getFields) self.form.useEndPoint.clicked.connect(self.getFields) self.form.extraOffset.editingFinished.connect(self.getFields) - self.form.segLen.editingFinished.connect(self.getFields) +# self.form.segLen.editingFinished.connect(self.getFields) self.form.rollRadius.editingFinished.connect(self.getFields) self.form.processHoles.clicked.connect(self.getFields) self.form.processPerimeter.clicked.connect(self.getFields) diff --git a/src/Mod/Path/PathScripts/PathProfileEdges.py b/src/Mod/Path/PathScripts/PathProfileEdges.py index 2c71d6adf..d999ffe3c 100644 --- a/src/Mod/Path/PathScripts/PathProfileEdges.py +++ b/src/Mod/Path/PathScripts/PathProfileEdges.py @@ -96,7 +96,7 @@ class ObjectProfile: obj.addProperty("App::PropertyDistance", "RollRadius", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Radius at start and end")) obj.addProperty("App::PropertyDistance", "OffsetExtra", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Extra value to stay away from final profile- good for roughing toolpath")) - obj.addProperty("App::PropertyLength", "SegLen", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Tesselation value for tool paths made from beziers, bsplines, and ellipses")) +# obj.addProperty("App::PropertyLength", "SegLen", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Tesselation value for tool paths made from beziers, bsplines, and ellipses")) obj.addProperty("App::PropertyAngle", "PlungeAngle", "Profile", QtCore.QT_TRANSLATE_NOOP("App::Property","Plunge angle with which the tool enters the work piece. Straight down is 90 degrees, if set small enough or zero the tool will descent exactly one layer depth down per turn")) obj.addProperty("App::PropertyVectorList", "locs", "Tags", QtCore.QT_TRANSLATE_NOOP("App::Property","List of holding tag locations")) @@ -473,24 +473,25 @@ class TaskPanel: def getFields(self): if self.obj: + if hasattr(self.obj, "StartDepth"): - self.obj.StartDepth = self.form.startDepth.text() + self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value if hasattr(self.obj, "FinalDepth"): - self.obj.FinalDepth = self.form.finalDepth.text() + self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value if hasattr(self.obj, "SafeHeight"): - self.obj.SafeHeight = self.form.safeHeight.text() + self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value if hasattr(self.obj, "ClearanceHeight"): - self.obj.ClearanceHeight = self.form.clearanceHeight.text() + self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value if hasattr(self.obj, "StepDown"): - self.obj.StepDown = self.form.stepDown.text() + self.obj.StepDown = FreeCAD.Units.Quantity(self.form.stepDown.text()).Value if hasattr(self.obj, "OffsetExtra"): - self.obj.OffsetExtra = self.form.extraOffset.text() - if hasattr(self.obj, "SegLen"): - self.obj.SegLen = self.form.segLen.value() + self.obj.OffsetExtra = FreeCAD.Units.Quantity(self.form.extraOffset.text()).Value +# if hasattr(self.obj, "SegLen"): +# self.obj.SegLen = self.form.segLen.value() if hasattr(self.obj, "RollRadius"): - self.obj.RollRadius = self.form.rollRadius.text() + self.obj.RollRadius = FreeCAD.Units.Quantity(self.form.rollRadius.text()).Value if hasattr(self.obj, "PlungeAngle"): - self.obj.PlungeAngle = str(self.form.plungeAngle.value()) + self.obj.PlungeAngle = FreeCAD.Units.Quantity(self.form.plungeAngle.text()).Value if hasattr(self.obj, "UseComp"): self.obj.UseComp = self.form.useCompensation.isChecked() if hasattr(self.obj, "UseStartPoint"): @@ -506,15 +507,15 @@ class TaskPanel: self.obj.Proxy.execute(self.obj) def setFields(self): - self.form.startDepth.setText(str(self.obj.StartDepth.Value)) - self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) - self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) - self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value)) - self.form.stepDown.setText(str(self.obj.StepDown.Value)) - self.form.extraOffset.setText(str(self.obj.OffsetExtra.Value)) - self.form.segLen.setValue(self.obj.SegLen.Value) - self.form.rollRadius.setText(str(self.obj.RollRadius.Value)) - self.form.plungeAngle.setValue(self.obj.PlungeAngle.Value) + self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString) + self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString) + self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString) + self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString) + self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown.Value, FreeCAD.Units.Length).UserString) + self.form.extraOffset.setText(FreeCAD.Units.Quantity(self.obj.OffsetExtra.Value, FreeCAD.Units.Length).UserString) +# self.form.segLen.setValue(self.obj.SegLen.Value) + self.form.rollRadius.setText(FreeCAD.Units.Quantity(self.obj.RollRadius.Value, FreeCAD.Units.Length).UserString) + self.form.plungeAngle.setText(FreeCAD.Units.Quantity(self.obj.PlungeAngle.Value, FreeCAD.Units.Angle).UserString) self.form.useCompensation.setChecked(self.obj.UseComp) self.form.useStartPoint.setChecked(self.obj.UseStartPoint) self.form.useEndPoint.setChecked(self.obj.UseEndPoint) @@ -729,7 +730,7 @@ class TaskPanel: self.form.useStartPoint.clicked.connect(self.getFields) self.form.useEndPoint.clicked.connect(self.getFields) self.form.extraOffset.editingFinished.connect(self.getFields) - self.form.segLen.editingFinished.connect(self.getFields) +# self.form.segLen.editingFinished.connect(self.getFields) self.form.rollRadius.editingFinished.connect(self.getFields) # Tag Form diff --git a/src/Mod/Path/PathScripts/PathSurface.py b/src/Mod/Path/PathScripts/PathSurface.py index 613fdd46d..4dd334298 100644 --- a/src/Mod/Path/PathScripts/PathSurface.py +++ b/src/Mod/Path/PathScripts/PathSurface.py @@ -442,19 +442,19 @@ class TaskPanel: def getFields(self): if self.obj: - if hasattr(self.obj, "StartDepth"): - self.obj.StartDepth = self.form.startDepth.text() - if hasattr(self.obj, "FinalDepth"): - self.obj.FinalDepth = self.form.finalDepth.text() - if hasattr(self.obj, "FinishDepth"): - self.obj.FinishDepth = self.form.finishDepth.text() - if hasattr(self.obj, "StepDown"): - self.obj.StepDown = self.form.stepDown.value() + if hasattr(self.obj, "StartDepth"): + self.obj.StartDepth = FreeCAD.Units.Quantity(self.form.startDepth.text()).Value + if hasattr(self.obj, "FinalDepth"): + self.obj.FinalDepth = FreeCAD.Units.Quantity(self.form.finalDepth.text()).Value + if hasattr(self.obj, "FinishDepth"): + self.obj.FinishDepth = FreeCAD.Units.Quantity(self.form.finishDepth.text()).Value + if hasattr(self.obj, "StepDown"): + self.obj.StepDown = FreeCAD.Units.Quantity(self.form.stepDown.text()).Value if hasattr(self.obj, "SafeHeight"): - self.obj.SafeHeight = self.form.safeHeight.text() + self.obj.SafeHeight = FreeCAD.Units.Quantity(self.form.safeHeight.text()).Value if hasattr(self.obj, "ClearanceHeight"): - self.obj.ClearanceHeight = self.form.clearanceHeight.text() + self.obj.ClearanceHeight = FreeCAD.Units.Quantity(self.form.clearanceHeight.text()).Value if hasattr(self.obj, "Algorithm"): self.obj.Algorithm = str( self.form.algorithmSelect.currentText()) @@ -462,13 +462,12 @@ class TaskPanel: self.obj.Proxy.execute(self.obj) def setFields(self): - self.form.startDepth.setText(str(self.obj.StartDepth.Value)) - self.form.finalDepth.setText(str(self.obj.FinalDepth.Value)) - self.form.finishDepth.setText(str(self.obj.FinishDepth.Value)) - self.form.stepDown.setValue(self.obj.StepDown) - - self.form.safeHeight.setText(str(self.obj.SafeHeight.Value)) - self.form.clearanceHeight.setText(str(self.obj.ClearanceHeight.Value)) + self.form.startDepth.setText(FreeCAD.Units.Quantity(self.obj.StartDepth.Value, FreeCAD.Units.Length).UserString) + self.form.finalDepth.setText(FreeCAD.Units.Quantity(self.obj.FinalDepth.Value, FreeCAD.Units.Length).UserString) + self.form.finishDepth.setText(FreeCAD.Units.Quantity(self.obj.FinishDepth.Value, FreeCAD.Units.Length).UserString) + self.form.stepDown.setText(FreeCAD.Units.Quantity(self.obj.StepDown, FreeCAD.Units.Length).UserString) + self.form.safeHeight.setText(FreeCAD.Units.Quantity(self.obj.SafeHeight.Value, FreeCAD.Units.Length).UserString) + self.form.clearanceHeight.setText(FreeCAD.Units.Quantity(self.obj.ClearanceHeight.Value, FreeCAD.Units.Length).UserString) for i in self.obj.Base: self.form.baseList.addItem(i[0].Name)