add step angle option for lathe (perhaps determine heuristically in the future)
This commit is contained in:
parent
26b3f0a9e2
commit
47bd68ca0b
6 changed files with 36 additions and 32 deletions
|
|
@ -1339,6 +1339,7 @@ CAM.init = function(kiri, api) {
|
|||
tool: 'camLatheTool',
|
||||
spindle: 'camLatheSpindle',
|
||||
step: 'camLatheOver',
|
||||
angle: 'camLatheAngle',
|
||||
rate: 'camLatheSpeed',
|
||||
tolerance: 'camTolerance',
|
||||
axis: 'X'
|
||||
|
|
@ -1349,6 +1350,7 @@ 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}),
|
||||
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,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}),
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -857,8 +857,8 @@ class OpLathe extends CamOp {
|
|||
let { settings } = state;
|
||||
|
||||
let { setTool, setSpindle, setPrintPoint } = ops;
|
||||
let { camOut, newLayer, polyEmit, printPoint, lastPoint } = ops;
|
||||
let { bounds, zmax } = ops;
|
||||
let { camOut, newLayer, printPoint } = ops;
|
||||
let { zmax } = ops;
|
||||
|
||||
let toolDiam = new CAM.Tool(settings, op.tool).fluteDiameter();
|
||||
let stepover = toolDiam * op.step * 2;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ 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.traceOffset() * 2) * op.step;
|
||||
step = this.step = (tool.traceOffset() * 2) * op.step,
|
||||
angle = this.angle = op.angle || 1;
|
||||
|
||||
if (tolerance === 0) {
|
||||
console.log(widget.id, 'topo4 auto tolerance', resolution.round(4));
|
||||
|
|
@ -108,7 +109,7 @@ class Topo4 {
|
|||
index++;
|
||||
}
|
||||
slices.push(slice);
|
||||
console.log({ shards, range, step, slices });
|
||||
// console.log({ shards, range, step, slices });
|
||||
|
||||
if (kiri.minions.running > 1) {
|
||||
return await this.sliceMinions(onupdate);
|
||||
|
|
@ -265,11 +266,10 @@ class Topo4 {
|
|||
async latheWorker(onupdate) {
|
||||
const { sliced, tool } = this;
|
||||
|
||||
const steps = 100;
|
||||
const rota = (360 / steps) * DEG2RAD;
|
||||
const rota = this.angle * DEG2RAD;
|
||||
const steps = (Math.PI * 2) / rota;
|
||||
const axis = new THREE.Vector3(1, 0, 0);
|
||||
const mrot = new THREE.Matrix4().makeRotationAxis(axis, rota);
|
||||
|
||||
const slices = sliced.map(s => { return { z: s.z, lines: s.shared } });
|
||||
const paths = [];
|
||||
const recs = [];
|
||||
|
|
@ -295,36 +295,21 @@ class Topo4 {
|
|||
}
|
||||
|
||||
for (let rec of recs) {
|
||||
const { angle, degrees, heights } = rec;
|
||||
const points = heights.toFloat32();
|
||||
|
||||
const poly = newPolygon().setOpen().addPoints(
|
||||
[...points].group(3).map((a,i) => {
|
||||
let p = newPoint(a[0], a[1], a[2]).setA(degrees)
|
||||
paths[i].camLines[0].push(p);
|
||||
return p;
|
||||
})
|
||||
);
|
||||
rotatePoints(points, new THREE.Matrix4().makeRotationAxis(axis, angle));
|
||||
continue;
|
||||
|
||||
// const slice = newSlice();
|
||||
// slice.camLines = [ poly ];
|
||||
|
||||
// const rndr = newPolygon().setOpen().addPoints(
|
||||
// [...points].group(3).map(a => newPoint(a[0], a[1], a[2]))
|
||||
// );
|
||||
|
||||
// slice.output()
|
||||
// .setLayer("lathe", { line: 0xffff00 })
|
||||
// .addPoly(rndr);
|
||||
// paths.push(slice);
|
||||
const { degrees, heights } = rec;
|
||||
[...heights].group(3).forEach((a,i) => {
|
||||
paths[i].camLines[0].push( newPoint(a[0], a[1], a[2]).setA(degrees) );
|
||||
});
|
||||
}
|
||||
|
||||
for (let slice of paths) {
|
||||
const poly = slice.camLines[0];
|
||||
if (!poly.length) {
|
||||
continue;
|
||||
}
|
||||
slice.camLines[0].push(poly.points[0].clone());
|
||||
slice.output()
|
||||
.setLayer("lathe", { line: 0xffff00 })
|
||||
.addPoly(slice.camLines[0]);
|
||||
.addPoly(poly.clone().applyRotations());
|
||||
}
|
||||
|
||||
// console.log({ tool, slices, paths });
|
||||
|
|
|
|||
Loading…
Reference in a new issue