adjust tool pos to units. fix slicer bucketing

This commit is contained in:
Stewart Allen 2020-11-30 11:30:02 -05:00
commit b3cbd701a9
3 changed files with 6 additions and 5 deletions

View file

@ -4,7 +4,6 @@
* `cnc` * `cnc`
* - tracing (chamfer, engrave) * - tracing (chamfer, engrave)
* - auto feature detection (slicing) * - auto feature detection (slicing)
* - show tool x,y,z during animation
* `laser` * `laser`
* - drag knife support * - drag knife support
* `all` * `all`

View file

@ -162,7 +162,7 @@
if (bucketCount > 1) { if (bucketCount > 1) {
// create empty buckets // create empty buckets
for (let i = 0; i < bucketCount + 1; i++) { for (let i = 0; i <= bucketCount + 1; i++) {
buckets.push([]); buckets.push([]);
} }

View file

@ -8,6 +8,7 @@ self.kiri.loader.push(function() {
CAM = KIRI.driver.CAM, CAM = KIRI.driver.CAM,
API, WORLD, SPACE, API, WORLD, SPACE,
meshes = {}, meshes = {},
unitScale = 1,
toolPosX, toolPosY, toolPosZ, toolPosX, toolPosY, toolPosZ,
speedValues = [ 25, 12, 6, 3 ], speedValues = [ 25, 12, 6, 3 ],
speedNames = [ "1x", "2x", "4x", "8x" ], speedNames = [ "1x", "2x", "4x", "8x" ],
@ -96,9 +97,9 @@ self.kiri.loader.push(function() {
mesh.position.z = pos.z; mesh.position.z = pos.z;
SPACE.update(); SPACE.update();
if (id !== 0) { if (id !== 0) {
toolPosX.value = pos.x.toFixed(2); toolPosX.value = (pos.x * unitScale).toFixed(2);
toolPosY.value = pos.y.toFixed(2); toolPosY.value = (pos.y * unitScale).toFixed(2);
toolPosZ.value = pos.z.toFixed(2); toolPosZ.value = (pos.z * unitScale).toFixed(2);
} }
} }
} }
@ -169,6 +170,7 @@ self.kiri.loader.push(function() {
if (KIRI.client) if (KIRI.client)
KIRI.client.animate_setup = function(settings, ondone) { KIRI.client.animate_setup = function(settings, ondone) {
unitScale = settings.controller.units === 'in' ? 1/25.4 : 1;
send("animate_setup", {settings}, ondone); send("animate_setup", {settings}, ondone);
}; };