cleanup
This commit is contained in:
parent
4ec8f845c5
commit
cd8e89d419
2 changed files with 12 additions and 32 deletions
|
|
@ -5,7 +5,6 @@
|
||||||
/**
|
/**
|
||||||
* Slicing engine used by CAM Topo
|
* Slicing engine used by CAM Topo
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gapp.register("kiri-mode.cam.slicer2", [], (root, exports) => {
|
gapp.register("kiri-mode.cam.slicer2", [], (root, exports) => {
|
||||||
|
|
||||||
const { base, kiri } = root;
|
const { base, kiri } = root;
|
||||||
|
|
|
||||||
|
|
@ -441,40 +441,18 @@ class Topo {
|
||||||
ondone(newslices);
|
ondone(newslices);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('topo slice 2');
|
const slices2 = await this.topo_slice(widget, resolution);
|
||||||
const slices2 = await kiri.topo_slice(widget, resolution);
|
|
||||||
console.log({ topo_slice_done: slices2 });
|
|
||||||
processSlices(slices2);
|
processSlices(slices2);
|
||||||
return this;
|
|
||||||
|
|
||||||
let points = base.verticesToPoints(widget.getGeoVertices({ unroll: true, translate: true }));
|
|
||||||
let slicer = new kiri.cam_slicer(points, {
|
|
||||||
swapX: true, emptyok: true, notopok: true
|
|
||||||
});
|
|
||||||
let sindex = slicer.interval(resolution);
|
|
||||||
if (!topo.slices) stepsTotal += sindex.length * 2;
|
|
||||||
if (contourX) stepsTotal += Math.round((maxY-minY) / toolStep);
|
|
||||||
if (contourY) stepsTotal += Math.round((maxX-minX) / toolStep);
|
|
||||||
|
|
||||||
let slices = topo.slices = topo.slices || slicer.slice(sindex, { each: (data, index, total) => {
|
|
||||||
onupdate(++stepsTaken, stepsTotal, "topo slice");
|
|
||||||
}, genso: true });
|
|
||||||
|
|
||||||
processSlices(slices.filter(s => s.lines).map(data => data.slice));
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
CAM.Topo = async function(opt) {
|
async topo_slice(widget, resolution) {
|
||||||
return new Topo().generate(opt);
|
|
||||||
};
|
|
||||||
|
|
||||||
moto.broker.subscribe("worker.started", msg => {
|
|
||||||
const { dispatch, minions } = msg;
|
|
||||||
// console.log({ cam_slicer2_worker: msg });
|
|
||||||
kiri.topo_slice = async (widget, resolution) => {
|
|
||||||
console.log({ topo_slice: widget, resolution });
|
console.log({ topo_slice: widget, resolution });
|
||||||
|
|
||||||
|
const dispatch = kiri.worker;
|
||||||
|
const minions = kiri.minions;
|
||||||
const vertices = widget.getGeoVertices().toShared();
|
const vertices = widget.getGeoVertices().toShared();
|
||||||
const range = { min: Infinity, max: -Infinity };
|
const range = { min: Infinity, max: -Infinity };
|
||||||
|
|
||||||
|
|
@ -569,13 +547,16 @@ moto.broker.subscribe("worker.started", msg => {
|
||||||
output.appendAll(res);
|
output.appendAll(res);
|
||||||
}
|
}
|
||||||
output.sort((a,b) => a.z - b.z);
|
output.sort((a,b) => a.z - b.z);
|
||||||
console.log({ output });
|
|
||||||
console.timeEnd('new topo slice');
|
console.timeEnd('new topo slice');
|
||||||
return output;
|
return output;
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
CAM.Topo = async function(opt) {
|
||||||
|
return new Topo().generate(opt);
|
||||||
|
};
|
||||||
|
|
||||||
moto.broker.subscribe("minion.started", msg => {
|
moto.broker.subscribe("minion.started", msg => {
|
||||||
// console.log({ cam_slicer2_minion: msg });
|
// console.log({ cam_slicer2_minion: msg });
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue