Merge pull request #11972 from br4243/Fix_for_Vcarve_missing_letters_8064

Fix for issue 8064 missing letters when V-carving a string.

Excellent work!  Thank you.
This commit is contained in:
sliptonic
2024-01-14 13:26:14 -06:00
committed by GitHub

View File

@@ -264,9 +264,24 @@ class ObjectVcarve(PathEngraveBase.ObjectOp):
Path.Log.debug("discretize value: {}".format(obj.Discretize))
pts = wire.discretize(QuasiDeflection=obj.Discretize)
ptv = [FreeCAD.Vector(p.x, p.y) for p in pts]
# Check over the last point before just closing the polygon
# by adding the start again. If the discretizer was aiming
# for the last point and missed by a little bit, closing the
# polygon as is could result in OpenVoronoi truncating the
# coordinates to a self-intersecting polygon which is invalid.
# Instead, if the last point is close to the first, remove it
# and let the final append close the polygon.
# See issue 8064
if len(ptv) > 0:
dist = ptv[-1].distanceToPoint(ptv[0])
if dist < FreeCAD.Base.Precision.confusion():
Path.Log.debug(
"Removing bad carve point: {} from polygon origin"
.format(dist))
del ptv[-1]
ptv.append(ptv[0])
for i in range(len(pts)):
for i in range(len(ptv)-1):
vd.addSegment(ptv[i], ptv[i + 1])
def cutWire(edges):