add cam inner first routing option. add engine sample persistence

This commit is contained in:
Stewart Allen 2025-08-10 23:48:10 -04:00
commit 01b1349127
7 changed files with 23 additions and 3 deletions

View file

@ -556,6 +556,7 @@ export const conf = {
camTabsDepth: 5,
camTabsMidline: false,
camDepthFirst: false,
camInnerFirst: false,
camEaseDown: false,
camEaseAngle: 10,
camOriginTop: true,

View file

@ -97,6 +97,7 @@ export function menu() {
camConventional: newBoolean(LANG.ou_conv_s, onBooleanClick, {title:LANG.ou_conv_l}),
camEaseDown: newBoolean(LANG.cr_ease_s, onBooleanClick, {title:LANG.cr_ease_l}),
camDepthFirst: newBoolean(LANG.ou_depf_s, onBooleanClick, {title:LANG.ou_depf_l}),
camInnerFirst: newBoolean(LANG.ou_inrf_s, onBooleanClick, {title:LANG.ou_inrf_l}),
camToolInit: newBoolean(LANG.ou_toin_s, onBooleanClick, {title:LANG.ou_toin_l}),
separator: newBlank({ class:"set-sep", driven }),
camFirstZMax: newBoolean(LANG.ou_z1st_s, onBooleanClick, {title:LANG.ou_z1st_l}),

View file

@ -85,6 +85,7 @@ export function prepEach(widget, settings, print, firstPoint, update) {
easeDown = process.camEaseDown,
easeAngle = process.camEaseAngle,
depthFirst = process.camDepthFirst,
innerFirst = process.camInnerFirst,
engageFactor = process.camFullEngage,
arcTolerance = process.camArcTolerance,
arcRes = toRadians(process.camArcResolution),
@ -719,7 +720,10 @@ export function prepEach(widget, settings, print, firstPoint, update) {
setTool(tool, rate, plunge);
let traceTool = new Tool(settings, tool);
let traceToolDiam = traceTool.fluteDiameter();
printPoint = poly2polyEmit(slice.camLines, printPoint, polyEmit, { swapdir: false });
printPoint = poly2polyEmit(slice.camLines, printPoint, polyEmit, {
swapdir: false,
weight: innerFirst
});
newLayer();
}

View file

@ -87,6 +87,8 @@ export async function cam_slice(settings, widget, onupdate, ondone) {
bottom_z, bottom_cut
}, 3);
console.log({ track, bounds, stock, workarea });
return structuredClone(workarea);
};

View file

@ -126,6 +126,10 @@ class Engine {
return this;
}
setTopOffset(offset = 0) {
this.topOffset = offset;
}
setOrigin(x, y, z) {
this.settings.origin = { x, y, z };
return this;
@ -152,6 +156,7 @@ class Engine {
}
slice() {
this.widget.setTopZ(this.settings.stock.z - (this.topOffset || 0));
return new Promise((accept, reject) => {
client.clear();
client.sync([this.widget]);

View file

@ -99,7 +99,11 @@
});
edit.session.setTabSize(4);
edit.session.setUseSoftTabs(true);
let FDMExample = loadExample(demoFDM)
if (localStorage.engineCode) {
edit.session.setValue(localStorage.engineCode);
} else {
loadExample(demoFDM);
}
}
function display_message(msg) {
$('gfoot').innerText = msg ? Object.keys(msg).join(' - ') : '';
@ -124,6 +128,7 @@
$('gfoot').style.display = 'block';
let code = edit.session.getValue();
eval(`(function(){${code}})()`);
localStorage.engineCode = code;
}
function demoFDM() {
new Engine()

View file

@ -790,6 +790,8 @@ self.lang['en-us'] = {
ou_conv_l: ["milling direction","uncheck for 'climb'"],
ou_depf_s: "depth first",
ou_depf_l: ["optimize pocket cuts","with depth priority"],
ou_inrf_s: "inner first",
ou_inrf_l: ["always cut inner to outer"],
ou_toin_s: "tool init",
ou_toin_l: "add tool change with first operation. when disabled, the gcode assumes the first tool is loaded and offset probed",
ou_forz_s: "force z max",