update manifold calls in 4-axis animations

This commit is contained in:
Stewart Allen 2024-07-27 10:30:29 -04:00
commit 8788b91d9b
2 changed files with 10 additions and 9 deletions

View file

@ -243,7 +243,7 @@ class Stock {
this.sends = 0;
this.newbuf = true;
this.subtracts = 0;
this.mesh = CSG.Instance().cube([x, y, z], true);
this.mesh = CSG.Instance().Manifold.cube([x, y, z], true);
}
send(send) {
@ -280,7 +280,7 @@ class Stock {
let mesh = this.mesh.getMesh();
this.sharedVertexBuffer(mesh.numVert * 3);
this.sharedIndexBuffer(mesh.numTri * 3);
this.vbuf.set(mesh.vertPos);
this.vbuf.set(mesh.vertProperties);
this.ibuf.set(mesh.triVerts);
let sub = Date.now();
updates.push(this);
@ -589,20 +589,21 @@ kiri.load(() => {
const srad = tool.shaftDiameter() / 2;
const flen = tool.fluteLength() || 15;
const frad = toolRadius = tool.fluteDiameter() / 2;
let { cylinder, sphere } = Instance.Manifold;
let mesh;
if (tool.isBallMill()) {
mesh = Instance.cylinder(flen + slen - frad, frad, frad, 20, true)
.add(Instance.sphere(frad, 20).translate(0, 0, -(flen + slen - frad)/2));
mesh = cylinder(flen + slen - frad, frad, frad, 20, true)
.add(sphere(frad, 20).translate(0, 0, -(flen + slen - frad)/2));
} else if (tool.isTaperMill()) {
const trad = Math.max(tool.tipDiameter() / 2, 0.001);
mesh = Instance.cylinder(slen, srad, srad, 20, true).translate(0, 0, slen/2)
.add(Instance.cylinder(flen, trad, frad, 20, true).translate(0, 0, -flen/2));
mesh = cylinder(slen, srad, srad, 20, true).translate(0, 0, slen/2)
.add(cylinder(flen, trad, frad, 20, true).translate(0, 0, -flen/2));
} else {
mesh = Instance.cylinder(flen + slen, frad, frad, 20, true);
mesh = cylinder(flen + slen, frad, frad, 20, true);
}
mesh = mesh.translate(0, 0, (flen + slen - stockZ) / 2);
const raw = mesh.getMesh();
const vertex = raw.vertPos;
const vertex = raw.vertProperties;
const index = raw.triVerts;
toolMesh = { root: mesh, index, vertex, bounds: CSG.toBox3(mesh) };
send.data({ mesh_add: { id:--toolID, ind: index, pos: vertex }});

View file

@ -502,7 +502,7 @@ CAM.init = function(kiri, api) {
let clock = rec.type === '|';
let label = clock ? `` : rec.type;
let clazz = notime ? [ "draggable", "notime" ] : [ "draggable" ];
let notable = rec.note?.split(' ').filter(v => v.charAt(0) === '#');
let notable = rec.note ? rec.note.split(' ').filter(v => v.charAt(0) === '#') : undefined;
if (clock) { clazz.push('clock'); title = ` title="end of ops chain\ndrag/drop like an op\nops after this are disabled"` }
if (notable?.length) label = notable[0].slice(1);
html.appendAll([