add stock indexing process parameter. animation style tracks stock indexing

This commit is contained in:
Stewart Allen 2022-10-28 10:28:27 -04:00
commit f2828afbd8
5 changed files with 16 additions and 3 deletions

View file

@ -338,6 +338,7 @@ kiri.load(() => {
let stock, center, rez;
let path, pathIndex, tool, tools, last;
let stockZ;
let stockIndexMsg = false;
let stockSlices;
let stockIndex;
@ -380,6 +381,7 @@ kiri.load(() => {
indexCount = 0;
startTime = 0;
updates = 0;
stockZ = stock.z;
stockSlices = [];
const { x, y, z } = stock;
@ -387,11 +389,12 @@ kiri.load(() => {
const sliceWidth = stock.x / sliceCount;
for (let i=0; i<sliceCount; i++) {
let xmin = -(x/2) + (i * sliceWidth) + sliceWidth / 2;
let slice = new Stock(sliceWidth, y, z).translate(xmin, 0, z / 2);
let slice = new Stock(sliceWidth, y, z).translate(xmin, 0, 0);
slice.dim = { xmin: xmin - sliceWidth / 2, xmax: xmin + sliceWidth / 2 };
stockSlices.push(slice);
slice.updateMesh([]);
slice.send(send);
// send({ mesh_move: { id: slice.id, pos: { x:0, y:0, z: stock.z/2} } });
}
send.done();
@ -601,7 +604,7 @@ kiri.load(() => {
} else {
mesh = Module.cylinder(flen + slen, frad, frad, 20, true);
}
mesh = mesh.translate(0, 0, (flen + slen) / 2);
mesh = mesh.translate(0, 0, (flen + slen - stockZ) / 2);
const { vertex, index } = mesh.getMesh({ normal: () => undefined });
toolMesh = { root: mesh, index, vertex };
send.data({ mesh_add: { id:--toolID, ind: index, pos: vertex }});

View file

@ -26,7 +26,7 @@ let isAnimate,
let zaxis = { x: 0, y: 0, z: 1 },
popOp = {},
animVer = 1,
animVer = 0,
seed = Date.now(),
func = {
hover: noop,
@ -63,6 +63,10 @@ CAM.init = function(kiri, api) {
return API.conf.get().process.camZBottom > 0;
}
function setAnimationStyle(settings) {
animVer = settings.process.camStockIndexed ? 1 : 0;
}
// wire up animate button in ui
api.event.on("function.animate", (mode) => {
if (isAnimate) {
@ -127,6 +131,7 @@ CAM.init = function(kiri, api) {
api.ui.camTabs.marker.style.display = hasTabs ? 'flex' : 'none';
api.ui.camStock.marker.style.display = proc.camStockOn ? 'flex' : 'none';
updateStock(settings, 'settings.saved.internal');
setAnimationStyle(settings);
});
api.event.on("settings.load", (settings) => {
@ -134,6 +139,7 @@ CAM.init = function(kiri, api) {
if (!isCamMode) return;
validateTools(settings.tools);
restoreTabs(api.widgets.all());
setAnimationStyle(settings);
});
api.event.on([

View file

@ -564,6 +564,7 @@ const conf = exports({
camStockZ: 0,
camStockOffset: true,
camStockClipTo: false,
camStockIndexed: false,
camStockOn: true,
camConventional: false, // outputClockwise
outputOriginCenter: false,

View file

@ -1906,6 +1906,7 @@ gapp.register("kiri.init", [], (root, exports) => {
camStockZ: uc.newInput(LANG.cs_hght_s, {title:LANG.cs_hght_l, convert:uc.toFloat, bound:uc.bound(0,9999), modes:CAM, units:true}),
camStockOffset: uc.newBoolean(LANG.cs_offs_s, onBooleanClick, {title:LANG.cs_offs_l, modes:CAM}),
camStockClipTo: uc.newBoolean(LANG.cs_clip_s, onBooleanClick, {title:LANG.cs_clip_l, modes:CAM}),
camStockIndexed: uc.newBoolean(LANG.cs_indx_s, onBooleanClick, {title:LANG.cs_indx_l, modes:CAM}),
camSep: uc.newBlank({class:"pop-sep"}),
camStockOn: uc.newBoolean(LANG.cs_offe_s, onBooleanClick, {title:LANG.cs_offe_l, modes:CAM}),

View file

@ -681,6 +681,8 @@ self.kiri.lang['en-us'] = {
cs_offs_l: ["use width, depth, height","as offsets from max","part size on platform"],
cs_clip_s: "clip to",
cs_clip_l: ["rough and outline","clip cutting paths","to defined stock"],
cs_indx_s: "indexed",
cs_indx_l: ["stock is mounted to a rotatary indexer"],
cs_offe_s: "enable",
cs_offe_l: "enable milling stock",