add experimental lathe linear passes
This commit is contained in:
parent
e29fd194bb
commit
daedae0d41
5 changed files with 38 additions and 11 deletions
|
|
@ -1422,7 +1422,7 @@ CAM.init = function(kiri, api) {
|
|||
tolerance: 'camTolerance',
|
||||
filter: 'camContourFilter',
|
||||
leave: 'camContourLeave',
|
||||
axis: 'X'
|
||||
linear: 'camLatheLinear'
|
||||
}).inputs = {
|
||||
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||
// axis: UC.newSelect(LANG.cd_axis, {}, "xyaxis"),
|
||||
|
|
@ -1435,6 +1435,8 @@ CAM.init = function(kiri, api) {
|
|||
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)}),
|
||||
sep: UC.newBlank({class:"pop-sep"}),
|
||||
linear: UC.newBoolean(LANG.ci_line_s, undefined, {title:LANG.ci_line_l}),
|
||||
// filter: UC.newRow([ UC.newButton(LANG.filter, contourFilter) ], {class:"ext-buttons f-row"})
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -62,6 +62,10 @@ class Tool {
|
|||
return this.unitScale() * this.tool.taper_tip;
|
||||
}
|
||||
|
||||
maxDiameter() {
|
||||
return Math.max(this.fluteDiameter(), this.tipDiameter(), this.shaftDiameter());
|
||||
}
|
||||
|
||||
traceOffset() {
|
||||
return (this.isTaperMill() ? this.tipDiameter() : this.fluteDiameter()) / 2;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ class Topo4 {
|
|||
this.diam = tool.fluteDiameter();
|
||||
this.zoff = widget.track.top || 0;
|
||||
this.leave = op.leave || 0;
|
||||
this.linear = op.linear || false;
|
||||
this.lineColor = state.settings.controller.dark ? 0xffff00 : 0x555500;
|
||||
|
||||
onupdate(0, "lathe");
|
||||
|
|
@ -363,7 +364,7 @@ class Topo4 {
|
|||
}
|
||||
|
||||
async latheMinions(onupdate) {
|
||||
const { sliced, tool, zoff, leave, maxo, zBottom, step, resolution } = this;
|
||||
const { sliced, tool, zoff, leave, maxo, zBottom, step, resolution, linear } = this;
|
||||
const { putCache, clearCache, queue } = this;
|
||||
|
||||
const rota = this.angle * DEG2RAD;
|
||||
|
|
@ -404,13 +405,27 @@ class Topo4 {
|
|||
await Promise.all(promises);
|
||||
recs.sort((a, b) => { return b.angle - a.angle });
|
||||
|
||||
count = recs[0].heights.length / 3;
|
||||
// let linear = true;
|
||||
|
||||
count = linear ? recs.length : recs[0].heights.length / 3;
|
||||
while (count-- > 0) {
|
||||
let slice = newSlice(count);
|
||||
slice.camLines = [ newPolygon().setOpen() ];
|
||||
paths.push(slice);
|
||||
}
|
||||
|
||||
if (linear) {
|
||||
recs.forEach((rec,i) => {
|
||||
const { degrees, heights } = rec;
|
||||
[...heights].group(3).forEach((a) => {
|
||||
// progress each path 360 degrees to prevent A rolling backwards
|
||||
paths[i].camLines[0].push( newPoint(a[0], a[1], a[2] + leave).setA(degrees + i * -360) );
|
||||
});
|
||||
if (i % 2 === 1) {
|
||||
paths[i].camLines[0].reverse();
|
||||
}
|
||||
});
|
||||
} else {
|
||||
for (let rec of recs) {
|
||||
const { degrees, heights } = rec;
|
||||
[...heights].group(3).forEach((a,i) => {
|
||||
|
|
@ -418,6 +433,7 @@ class Topo4 {
|
|||
paths[i].camLines[0].push( newPoint(a[0], a[1], a[2] + leave).setA(degrees + i * -360) );
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (let slice of paths) {
|
||||
const poly = slice.camLines[0];
|
||||
|
|
@ -425,9 +441,11 @@ class Topo4 {
|
|||
console.log('empty', slice);
|
||||
continue;
|
||||
}
|
||||
if (!linear) {
|
||||
// repeat first point 360 degrees progressed
|
||||
const repeat = poly.points[0];
|
||||
slice.camLines[0].push(repeat.clone().setA(repeat.a - 360));
|
||||
}
|
||||
slice.output()
|
||||
.setLayer("lathe", { line: this.lineColor })
|
||||
.addPoly(poly.clone().applyRotations().move({ z: -zoff, x:0, y:0 }));
|
||||
|
|
|
|||
|
|
@ -725,6 +725,7 @@ button:hover {
|
|||
right: 0;
|
||||
bottom: 0;
|
||||
position: fixed;
|
||||
color: black;
|
||||
background-color: #fff;
|
||||
font-family: 'Russo One', sans-serif;
|
||||
z-index: 1000;
|
||||
|
|
|
|||
|
|
@ -607,6 +607,8 @@ self.kiri.lang['en-us'] = {
|
|||
ci_abso_l: "degree rotation is absolute",
|
||||
ci_face_s: "face",
|
||||
ci_face_l: "select face to rotate facing up",
|
||||
ci_line_s: "linear",
|
||||
ci_line_l: "make linear passes along X then rotate Y",
|
||||
|
||||
// CNC LASER On/Off Operations (Carvera)
|
||||
cl_powr_s: "power",
|
||||
|
|
|
|||
Loading…
Reference in a new issue