testing indexing of topo4 output

This commit is contained in:
Stewart Allen 2023-01-17 22:42:24 -05:00
commit 79f119c354
6 changed files with 30 additions and 12 deletions

View file

@ -50,6 +50,11 @@ class Point {
return this;
}
setA(a) {
this.a = a;
return this;
}
swapXZ() {
let p = this,
t = p.x;

View file

@ -824,6 +824,18 @@ class Polygon {
return this;
}
setA(a) {
for (let p of this.points) {
p.setA(a);
}
if (this.inner) {
for (let inner of this.inner) {
inner.setA(a);
}
}
return this;
}
/**
* set all points' z value
*

View file

@ -854,22 +854,17 @@ class OpLathe extends CamOp {
prepare(ops, progress) {
let { op, state, slices, topo } = this;
let { settings, widget } = state;
let { process } = settings;
let { settings } = state;
let { setTolerance, setTool, setSpindle, setPrintPoint } = ops;
let { setTool, setSpindle, setPrintPoint } = ops;
let { camOut, newLayer, polyEmit, printPoint, lastPoint } = ops;
let { bounds, zmax } = ops;
let toolDiam = new CAM.Tool(settings, op.tool).fluteDiameter();
let stepover = toolDiam * op.step * 2;
let cutdir = process.camConventional;
let depthFirst = process.camDepthFirst;
let depthData = [];
setTool(op.tool, op.rate, op.plunge);
setSpindle(op.spindle);
setTolerance(topo.tolerance);
// start top center, X = 0, Y = 0 closest to 4th axis chuck
printPoint = newPoint(0, 0, zmax);

View file

@ -241,7 +241,7 @@ CAM.slice = async function(settings, widget, onupdate, ondone) {
tracker.rotation = isIndexed ? axisRotation : 0;
// setup new state when indexing the workspace
if (true && op.op.type === "index") {
let points = base.verticesToPoints();
// let points = base.verticesToPoints();
state.slicer = new kiri.cam_slicer(widget);
shadows = {};
new CAM.OPS.shadow(state, { type: "shadow", silent: true }).slice(progress => {

View file

@ -36,7 +36,7 @@ class Topo {
contourY = axis === "y",
bounds = widget.getBoundingBox().clone(),
tolerance = contour.tolerance,
flatness = contour.flatness || 0.005,
flatness = contour.flatness || 0.001,
shadow = tshadow,
minX = bounds.min.x,
maxX = bounds.max.x,

View file

@ -287,15 +287,21 @@ class Topo4 {
for (let rec of recs) {
const { angle, heights } = rec;
const points = heights.toFloat32();
rotatePoints(points, new THREE.Matrix4().makeRotationAxis(axis, angle));
const poly = newPolygon().setOpen().addPoints(
[...points].group(3).map(a => newPoint(a[0], a[1], a[2]).setA(angle))
);
rotatePoints(points, new THREE.Matrix4().makeRotationAxis(axis, angle));
const top = newPolygon().setOpen().addPoints(
[...points].group(3).map(a => newPoint(a[0], a[1], a[2]))
);
const slice = newSlice().addTops([ poly ]);
const slice = newSlice().addTops([ top ]);
slice.camLines = [ poly ];
slice.output()
.setLayer("lathe", { line: 0xffff00 })
.addPoly(poly);
.addPoly(top);
paths.push(slice);
}