a new take on workspace units

This commit is contained in:
Stewart Allen 2020-11-05 11:00:34 -05:00
commit 7db47ca185
4 changed files with 101 additions and 60 deletions

View file

@ -299,8 +299,7 @@
let mesh = widget.mesh,
proc = settings.process,
outp = settings.process,
units = settings.controller.units === 'in' ? 25.4 : 1,
resolution = outp.camTolerance * units,
resolution = outp.camTolerance,
diameter = getToolDiameter(settings, proc.camContourTool),
tool = getToolById(settings, proc.camContourTool),
toolStep = diameter * proc.camContourOver,
@ -311,7 +310,7 @@
maxX = bounds.max.x,// + diameter,
minY = bounds.min.y,// - diameter,
maxY = bounds.max.y,// + diameter,
zBottom = outp.camZBottom * units,
zBottom = outp.camZBottom,
boundsX = maxX - minX,
boundsY = maxY - minY,
maxangle = proc.camContourAngle,
@ -697,7 +696,6 @@
proc = conf.process,
sliceAll = widget.slices = [],
unitsName = settings.controller.units,
units = unitsName === 'in' ? 25.4 : 1,
roughToolDiam = getToolDiameter(conf, proc.camRoughTool),
outlineToolDiam = getToolDiameter(conf, proc.camOutlineTool),
contourToolDiam = getToolDiameter(conf, proc.camContourTool),
@ -716,19 +714,19 @@
procTrace = proc.camTraceOn,
roughDown = procRough ? proc.camRoughDown : Infinity,
outlineDown = procOutline ? proc.camOutlineDown : Infinity,
sliceDepth = Math.max(0.1, Math.min(roughDown, outlineDown) / 3 * units),
sliceDepth = Math.max(0.1, Math.min(roughDown, outlineDown) / 3),
addTabsOutline = procOutlineOn && proc.camTabsOn,
tabWidth = proc.camTabsWidth * units,
tabHeight = proc.camTabsHeight * units,
tabWidth = proc.camTabsWidth,
tabHeight = proc.camTabsHeight,
bounds = widget.getBoundingBox(),
mesh = widget.mesh,
zBottom = proc.camZBottom * units,
zBottom = proc.camZBottom,
zMin = Math.max(bounds.min.z, zBottom),
zMax = bounds.max.z,
zThru = zBottom === 0 ? (proc.camZThru || 0) * units : 0,
ztOff = proc.camZTopOffset * units,
camRoughStock = proc.camRoughStock * units,
camRoughDown = proc.camRoughDown * units,
zThru = zBottom === 0 ? (proc.camZThru || 0) : 0,
ztOff = proc.camZTopOffset,
camRoughStock = proc.camRoughStock,
camRoughDown = proc.camRoughDown,
minStepDown = Math.min(1, roughDown, outlineDown),
maxToolDiam = 0,
sliceIndex = 0,
@ -1154,13 +1152,12 @@
slices = widget.slices,
bounds = widget.getCamBounds(settings),
boundsz = bounds.max.z,
units = settings.controller.units === 'in' ? 25.4 : 1,
hasStock = process.camStockOffset || (process.camStockZ && process.camStockX && process.camStockY),
startCenter = process.outputOriginCenter,
alignTop = settings.controller.alignTop,
zclear = (process.camZClearance || 1) * units,
zclear = (process.camZClearance || 1),
zmax_outer = hasStock ? stock.z + zclear : outerz + zclear,
ztOff = process.camZTopOffset * units,
ztOff = process.camZTopOffset,
zadd = hasStock ? stock.z - boundsz : alignTop ? outerz - boundsz : 0,
zmax = outerz + zclear,
wmpos = widget.mesh.position,
@ -1173,9 +1170,9 @@
modes = CPRO,
easeDown = process.camEaseDown,
depthFirst = process.camDepthFirst,
tolerance = process.camTolerance * units,
drillDown = process.camDrillDown * units,
drillLift = process.camDrillLift * units,
tolerance = process.camTolerance,
drillDown = process.camDrillDown,
drillLift = process.camDrillLift,
drillDwell = process.camDrillDwell,
newOutput = widgetIndex === 0 ? [] : print.output,
layerOut = [],
@ -1224,8 +1221,8 @@
}
lastTool = toolID;
}
feedRate = feed * units;
plungeRate = plunge * units;
feedRate = feed;
plungeRate = plunge;
}
function emitDrills(polys) {
@ -1694,9 +1691,8 @@
bounds = widget.getCamBounds(settings),
dev = settings.device,
spro = settings.process,
units = settings.controller.units === 'in' ? 25.4 : 1,
maxZd = spro.camFastFeedZ * units,
maxXYd = spro.camFastFeed * units,
maxZd = spro.camFastFeedZ,
maxXYd = spro.camFastFeed,
decimals = BASE.config.gcode_decimals || 4,
pos = { x:null, y:null, z:null, f:null, t:null },
line,