Increased tolerance for accepting tags.
This commit is contained in:
@@ -22,7 +22,6 @@
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
import FreeCAD
|
||||
import DraftGeomUtils
|
||||
import Part
|
||||
import Path
|
||||
import PathScripts
|
||||
@@ -640,13 +639,13 @@ 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
|
||||
@@ -657,7 +656,7 @@ class PathData:
|
||||
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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user