fix 0 segment length error in lathe slicing and threaded angle orders

This commit is contained in:
Stewart Allen 2023-03-05 16:30:51 -05:00
commit bfec51b544
3 changed files with 6 additions and 4 deletions

View file

@ -17,6 +17,7 @@ Full docs @ https://docs.grid.space/projects/kiri-moto
* CAM stock is now always on, whether offset or absolute
* CAM add lathe worker parallelization (2x - 6x speedup)
- add "common" overrides in ops (z top/bottom/thru, direction)
- fix lathe yellow path in normal (not dark) mode
# Release 3.8 (2023-01-21)

View file

@ -1359,8 +1359,8 @@ CAM.init = function(kiri, api) {
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}),
sep: UC.newBlank({class:"pop-sep"}),
step: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,10.0)}),
angle: UC.newInput(LANG.cc_sang_s, {title:LANG.cc_sang_l, convert:UC.toFloat, bound:UC.bound(0.01,90.0)}),
step: UC.newInput(LANG.cc_sovr_s, {title:LANG.cc_sovr_l, convert:UC.toFloat, bound:UC.bound(0.01,100.0)}),
angle: UC.newInput(LANG.cc_sang_s, {title:LANG.cc_sang_l, convert:UC.toFloat, bound:UC.bound(0.01,180.0)}),
sep: UC.newBlank({class:"pop-sep"}),
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}),
leave: UC.newInput(LANG.cf_leav_s, {title:LANG.cf_leav_l, convert:UC.toFloat, bound:UC.bound(0,100)}),

View file

@ -266,7 +266,7 @@ class Topo4 {
// get slice index corresponding with offset
const ts = si + xo;
// outside of slice array, skip
if (ts < 0 || ts >= slen) continue;
if (ts < 0 || ts >= slen - 1) continue;
const slice = oslices[ts];
const lines = slice.lines;
const plen = lines.length;
@ -280,6 +280,7 @@ class Topo4 {
if ((py0 <= yo && py1 >= yo) || (py1 <= yo && py0 >= yo)) {
const dz = pz1 - pz0;
const dy = Math.abs(py1 - py0);
if (dy === 0) continue;
const fr = Math.abs(yo - py0) / dy;
const lz = pz0 + dz * fr + zo;
// check z height
@ -400,7 +401,7 @@ class Topo4 {
}
await Promise.all(promises);
recs.sort((a, b) => { return a.angle - b.angle });
recs.sort((a, b) => { return b.angle - a.angle });
count = recs[0].heights.length / 3;
while (count-- > 0) {