use step for X increment. enable lathe for experimental work

This commit is contained in:
Stewart Allen 2023-01-22 16:52:37 -05:00
commit 6a8a070714
2 changed files with 14 additions and 8 deletions

View file

@ -295,7 +295,9 @@ CAM.init = function(kiri, api) {
}
return func.opAddContour(caxis);
case "lathe":
return;
if (!settings.controller.danger) {
return;
}
let laxis = "X";
for (let op of current.process.ops) {
if (op.type === "lathe" && op.axis === "X") {
@ -1342,7 +1344,7 @@ CAM.init = function(kiri, api) {
sep: UC.newBlank({class:"pop-sep"}),
spindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, show:hasSpindle}),
rate: UC.newInput(LANG.cc_feed_s, {title:LANG.cc_feed_l, convert:UC.toInt, units:true}),
step: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,2.0)}),
step: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,10.0)}),
tolerance: UC.newInput(LANG.ou_toll_s, {title:LANG.ou_toll_l, convert:UC.toFloat, bound:UC.bound(0,10.0), units:true, round:4}),
};

View file

@ -47,7 +47,7 @@ class Topo4 {
zMin = min.z + 0.0001,
tolerance = op.tolerance,
resolution = tolerance ? tolerance : 1 / Math.sqrt(density / (span.x * span.y)),
step = this.step = tool.fluteDiameter() * op.step;
step = this.step = (tool.traceOffset() * 2) * op.step;
if (tolerance === 0) {
console.log(widget.id, 'topo4 auto tolerance', resolution.round(4));
@ -96,7 +96,7 @@ class Topo4 {
let index = 0;
let slices = this.slices = [];
let slice = { min: range.min, max: range.min + step, index };
let slice = { min: range.min - step, max: range.min + step, index };
for (let z = range.min; z < range.max; z += resolution) {
if (z > slice.max) {
@ -188,12 +188,15 @@ class Topo4 {
}
lathePath(slices, tool) {
const { resolution } = this;
const { resolution, step } = this;
const tlen = tool.length;
const slen = slices.length;
const sinc = Math.max(1, Math.ceil(step / resolution));
const heights = [];
// console.log({ slen, step, resolution, sinc });
// cull slice lines to only the ones in range (5x faster)
const maxo = Math.max(...tool) * resolution;
const oslices = [];
@ -218,7 +221,7 @@ class Topo4 {
// iterate over all slices (real x = z)
// find max real z using z ray intersect from tool point to slice lines + offset
for (let si = 0; si < slen; si++) {
for (let si = 0; si < slen; si += sinc) {
const rx = oslices[si].z;
let mz = 0;
// iterate over tool offsets
@ -313,12 +316,13 @@ class Topo4 {
async latheMinions(onupdate) {
const { codec } = kiri;
const { sliced, resolution, tool } = this;
const { sliced, resolution, tool, step } = this;
const { putCache, clearCache, queue } = this;
console.log({ sliced });
putCache("lathe", {
tool,
step,
range,
resolution,
slices: sliced.map(s => { return { z: s.z, lines: s.shared } })
@ -401,7 +405,7 @@ moto.broker.subscribe("minion.started", msg => {
// console.log({ topo4_lathe: data });
// const { resolution } = data;
const { resolution, sliced, tool } = cache.lathe;
const { resolution, sliced, tool, step } = cache.lathe;
reply({ seq, abc: 123 });
}