diff --git a/src/Mod/Path/Gui/Resources/panels/PointEdit.ui b/src/Mod/Path/Gui/Resources/panels/PointEdit.ui
index 969f1ecfba..56fb47bc10 100644
--- a/src/Mod/Path/Gui/Resources/panels/PointEdit.ui
+++ b/src/Mod/Path/Gui/Resources/panels/PointEdit.ui
@@ -6,7 +6,7 @@
0
0
- 362
+ 294
182
@@ -18,27 +18,21 @@
-
-
+
Global X
- -
-
-
-
-
+
Global Y
- -
-
-
-
-
+
false
@@ -47,11 +41,46 @@
+ -
+
+
+ 6
+
+
+ -999999999.000000000000000
+
+
+ 999999999.000000000000000
+
+
+
+ -
+
+
+ 6
+
+
+ -999999999.000000000000000
+
+
+ 999999999.000000000000000
+
+
+
-
-
+
false
+
+ 6
+
+
+ -999999999.000000000000000
+
+
+ 999999999.000000000000000
+
@@ -68,9 +97,9 @@
- Gui::InputField
- QLineEdit
-
+ Gui::QuantitySpinBox
+ QDoubleSpinBox
+
diff --git a/src/Mod/Path/PathScripts/PathDressupHoldingTags.py b/src/Mod/Path/PathScripts/PathDressupHoldingTags.py
index 09c64ebc2a..06fca906d2 100644
--- a/src/Mod/Path/PathScripts/PathDressupHoldingTags.py
+++ b/src/Mod/Path/PathScripts/PathDressupHoldingTags.py
@@ -22,7 +22,6 @@
# * *
# ***************************************************************************
import FreeCAD
-import DraftGeomUtils
import Part
import Path
import PathScripts
@@ -640,27 +639,29 @@ class PathData:
def sortedTags(self, tags):
ordered = []
for edge in self.bottomEdges:
- ts = [t for t in tags if DraftGeomUtils.isPtOnEdge(t.originAt(self.minZ), edge)]
+ ts = [t for t in tags if PathGeom.isRoughly(0, Part.Vertex(t.originAt(self.minZ)).distToShape(edge)[0], 0.1)]
for t in sorted(ts, key=lambda t: (t.originAt(self.minZ) - edge.valueAt(edge.FirstParameter)).Length):
tags.remove(t)
ordered.append(t)
# disable all tags that are not on the base wire.
for tag in tags:
- PathLog.info("Tag #%d (%.2f, %.2f) not on base wire - disabling\n" % (len(ordered), tag.x, tag.y))
+ PathLog.info("Tag #%d (%.2f, %.2f, %.2f) not on base wire - disabling\n" % (len(ordered), tag.x, tag.y, self.minZ))
tag.enabled = False
ordered.append(tag)
return ordered
def pointIsOnPath(self, p):
- v = Part.Vertex(FreeCAD.Vector(p.x, p.y, self.minZ))
+ v = Part.Vertex(self.pointAtBottom(p))
PathLog.debug("pt = (%f, %f, %f)" % (v.X, v.Y, v.Z))
for e in self.bottomEdges:
indent = "{} ".format(e.distToShape(v)[0])
debugEdge(e, indent, True)
- if PathGeom.isRoughly(v.distToShape(e)[0], 0.0, 1.0):
+ if PathGeom.isRoughly(0.0, v.distToShape(e)[0], 0.1):
return True
return False
+ def pointAtBottom(self, p):
+ return FreeCAD.Vector(p.x, p.y, self.minZ)
class ObjectTagDressup:
@@ -772,7 +773,11 @@ class ObjectTagDressup:
debugEdge(edge, '++++++++')
if pathData.rapid.isRapid(edge):
v = edge.Vertexes[1]
- commands.append(Path.Command('G0', {'X': v.X, 'Y': v.Y, 'Z': v.Z}))
+ if not commands and PathGeom.isRoughly(0, v.X) and PathGeom.isRoughly(0, v.Y) and not PathGeom.isRoughly(0, v.Z):
+ # The very first move is just to move to ClearanceHeight
+ commands.append(Path.Command('G0', {'Z': v.Z}))
+ else:
+ commands.append(Path.Command('G0', {'X': v.X, 'Y': v.Y, 'Z': v.Z}))
else:
commands.extend(PathGeom.cmdsForEdge(edge, segm=segm))
edge = None
@@ -959,6 +964,10 @@ class ObjectTagDressup:
self.setup(obj)
return self.pathData.pointIsOnPath(point)
+ def pointAtBottom(self, obj, point):
+ if not hasattr(self, 'pathData'):
+ self.setup(obj)
+ return self.pathData.pointAtBottom(point)
def Create(baseObject, name = 'DressupTag'):
diff --git a/src/Mod/Path/PathScripts/PathDressupTagGui.py b/src/Mod/Path/PathScripts/PathDressupTagGui.py
index 6b6a7410a8..f25b55c87d 100644
--- a/src/Mod/Path/PathScripts/PathDressupTagGui.py
+++ b/src/Mod/Path/PathScripts/PathDressupTagGui.py
@@ -182,9 +182,11 @@ class PathDressupTagTaskPanel:
def generateNewTags(self):
count = self.form.sbCount.value()
+ PathLog.track(count)
if not self.obj.Proxy.generateTags(self.obj, count):
self.obj.Proxy.execute(self.obj)
-
+ self.Positions = self.obj.Positions
+ self.Disabled = self.obj.Disabled
self.updateTagsView()
def updateModel(self):
@@ -212,7 +214,7 @@ class PathDressupTagTaskPanel:
def updateTagsViewWith(self, tags):
self.tags = tags
- self.Positions = [FreeCAD.Vector(t[0], t[1], 0) for t in self.tags]
+ self.Positions = [FreeCAD.Vector(t[0], t[1], 0) for t in tags]
self.Disabled = [i for (i,t) in enumerate(self.tags) if not t[2]]
self.updateTagsView()
@@ -417,7 +419,7 @@ class PathDressupTagViewProvider:
self.switch.removeChild(tag.sep)
tags = []
for i, p in enumerate(positions):
- tag = HoldingTagMarker(p, self.colors)
+ tag = HoldingTagMarker(self.obj.Proxy.pointAtBottom(self.obj, p), self.colors)
tag.setEnabled(not i in disabled)
tags.append(tag)
self.switch.addChild(tag.sep)
diff --git a/src/Mod/Path/PathScripts/PathGetPoint.py b/src/Mod/Path/PathScripts/PathGetPoint.py
index bfe4d19dfb..a5c96a14ca 100644
--- a/src/Mod/Path/PathScripts/PathGetPoint.py
+++ b/src/Mod/Path/PathScripts/PathGetPoint.py
@@ -63,9 +63,13 @@ class TaskPanel:
self.formPoint.buttonBox.accepted.connect(self.pointAccept)
self.formPoint.buttonBox.rejected.connect(self.pointReject)
- self.formPoint.ifValueX.editingFinished.connect(self.updatePoint)
- self.formPoint.ifValueY.editingFinished.connect(self.updatePoint)
- self.formPoint.ifValueZ.editingFinished.connect(self.updatePoint)
+ self.formPoint.globalX.editingFinished.connect(self.updatePoint)
+ self.formPoint.globalY.editingFinished.connect(self.updatePoint)
+ self.formPoint.globalZ.editingFinished.connect(self.updatePoint)
+
+ self.formPoint.globalX.setProperty('unit', FreeCAD.Units.MilliMetre.getUserPreferred()[2])
+ self.formPoint.globalY.setProperty('unit', FreeCAD.Units.MilliMetre.getUserPreferred()[2])
+ self.formPoint.globalZ.setProperty('unit', FreeCAD.Units.MilliMetre.getUserPreferred()[2])
def addEscapeShortcut(self):
'''addEscapeShortcut() ... internal function - do not call.'''
@@ -93,11 +97,12 @@ class TaskPanel:
until the user explicitly closes Snapper. This lets the user enter multiple points in quick succession.'''
def displayPoint(p):
- self.formPoint.ifValueX.setText(FreeCAD.Units.Quantity(p.x, FreeCAD.Units.Length).UserString)
- self.formPoint.ifValueY.setText(FreeCAD.Units.Quantity(p.y, FreeCAD.Units.Length).UserString)
- self.formPoint.ifValueZ.setText(FreeCAD.Units.Quantity(p.z, FreeCAD.Units.Length).UserString)
- self.formPoint.ifValueX.setFocus()
- self.formPoint.ifValueX.selectAll()
+ self.point = p
+ self.formPoint.globalX.setProperty('rawValue', p.x)
+ self.formPoint.globalY.setProperty('rawValue', p.y)
+ self.formPoint.globalZ.setProperty('rawValue', p.z)
+ self.formPoint.globalX.setFocus()
+ self.formPoint.globalX.selectAll()
def mouseMove(cb):
p = None
@@ -114,6 +119,7 @@ class TaskPanel:
if hasattr(obj, 'Path'):
self.obj = obj
p = FreeCAD.Vector(snapInfo['x'], snapInfo['y'], snapInfo['z'])
+ self.pt = p
else:
self.obj = None
else:
@@ -124,6 +130,7 @@ class TaskPanel:
plane = FreeCAD.DraftWorkingPlane
p = plane.getLocalCoords(self.pt)
self.obj = FreeCADGui.Snapper.lastSnappedObject
+
if p:
displayPoint(p)
@@ -206,8 +213,11 @@ class TaskPanel:
def updatePoint(self):
'''updatePoint() ... internal function - do not call.'''
- x = FreeCAD.Units.Quantity(self.formPoint.ifValueX.text()).Value
- y = FreeCAD.Units.Quantity(self.formPoint.ifValueY.text()).Value
- z = FreeCAD.Units.Quantity(self.formPoint.ifValueZ.text()).Value
- self.pt = FreeCAD.Vector(x, y, z)
+ if self.point:
+ self.pt = self.point
+ else:
+ x = FreeCAD.Units.Quantity(self.formPoint.globalX.text()).Value
+ y = FreeCAD.Units.Quantity(self.formPoint.globalY.text()).Value
+ z = FreeCAD.Units.Quantity(self.formPoint.globalZ.text()).Value
+ self.pt = FreeCAD.Vector(x, y, z)