Use Decimal for depth calculation. Fixes #130.
This commit is contained in:
parent
705d038e1c
commit
ea27748697
|
@ -60,6 +60,13 @@ class CanvasCache(QtCore.QObject):
|
||||||
|
|
||||||
log.debug("Canvas update requested: %s" % str(extents))
|
log.debug("Canvas update requested: %s" % str(extents))
|
||||||
|
|
||||||
|
# Note: This information here might be out of date. Establish
|
||||||
|
# a protocol regarding when to change the canvas in the main
|
||||||
|
# thread and when to check these values here in the background,
|
||||||
|
# or pass this data in the signal (safer).
|
||||||
|
log.debug("Size: %s [px]" % str(self.plotcanvas.get_axes_pixelsize()))
|
||||||
|
log.debug("Density: %s [units/px]" % str(self.plotcanvas.get_density()))
|
||||||
|
|
||||||
# Move the requested screen portion to the main thread
|
# Move the requested screen portion to the main thread
|
||||||
# and inform about the update:
|
# and inform about the update:
|
||||||
|
|
||||||
|
|
16
camlib.py
16
camlib.py
|
@ -16,6 +16,7 @@ from matplotlib.figure import Figure
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
from decimal import Decimal
|
||||||
|
|
||||||
import collections
|
import collections
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
@ -2865,17 +2866,24 @@ class CNCjob(Geometry):
|
||||||
|
|
||||||
#--------- Multi-pass ---------
|
#--------- Multi-pass ---------
|
||||||
else:
|
else:
|
||||||
|
if isinstance(self.z_cut, Decimal):
|
||||||
|
z_cut = self.z_cut
|
||||||
|
else:
|
||||||
|
z_cut = Decimal(self.z_cut).quantize(Decimal('0.000000001'))
|
||||||
|
|
||||||
if depthpercut is None:
|
if depthpercut is None:
|
||||||
depthpercut = self.z_cut
|
depthpercut = z_cut
|
||||||
|
elif not isinstance(depthpercut, Decimal):
|
||||||
|
depthpercut = Decimal(depthpercut).quantize(Decimal('0.000000001'))
|
||||||
|
|
||||||
depth = 0
|
depth = 0
|
||||||
reverse = False
|
reverse = False
|
||||||
while depth > self.z_cut:
|
while depth > z_cut:
|
||||||
|
|
||||||
# Increase depth. Limit to z_cut.
|
# Increase depth. Limit to z_cut.
|
||||||
depth -= depthpercut
|
depth -= depthpercut
|
||||||
if depth < self.z_cut:
|
if depth < z_cut:
|
||||||
depth = self.z_cut
|
depth = z_cut
|
||||||
|
|
||||||
# Cut at specific depth and do not lift the tool.
|
# Cut at specific depth and do not lift the tool.
|
||||||
# Note: linear2gcode() will use G00 to move to the
|
# Note: linear2gcode() will use G00 to move to the
|
||||||
|
|
Loading…
Reference in New Issue