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, camTabsDepth: 5,
camTabsMidline: false, camTabsMidline: false,
camDepthFirst: false, camDepthFirst: false,
camInnerFirst: false,
camEaseDown: false, camEaseDown: false,
camEaseAngle: 10, camEaseAngle: 10,
camOriginTop: true, camOriginTop: true,

View file

@ -97,6 +97,7 @@ export function menu() {
camConventional: newBoolean(LANG.ou_conv_s, onBooleanClick, {title:LANG.ou_conv_l}), camConventional: newBoolean(LANG.ou_conv_s, onBooleanClick, {title:LANG.ou_conv_l}),
camEaseDown: newBoolean(LANG.cr_ease_s, onBooleanClick, {title:LANG.cr_ease_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}), 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}), camToolInit: newBoolean(LANG.ou_toin_s, onBooleanClick, {title:LANG.ou_toin_l}),
separator: newBlank({ class:"set-sep", driven }), separator: newBlank({ class:"set-sep", driven }),
camFirstZMax: newBoolean(LANG.ou_z1st_s, onBooleanClick, {title:LANG.ou_z1st_l}), 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, easeDown = process.camEaseDown,
easeAngle = process.camEaseAngle, easeAngle = process.camEaseAngle,
depthFirst = process.camDepthFirst, depthFirst = process.camDepthFirst,
innerFirst = process.camInnerFirst,
engageFactor = process.camFullEngage, engageFactor = process.camFullEngage,
arcTolerance = process.camArcTolerance, arcTolerance = process.camArcTolerance,
arcRes = toRadians(process.camArcResolution), arcRes = toRadians(process.camArcResolution),
@ -719,7 +720,10 @@ export function prepEach(widget, settings, print, firstPoint, update) {
setTool(tool, rate, plunge); setTool(tool, rate, plunge);
let traceTool = new Tool(settings, tool); let traceTool = new Tool(settings, tool);
let traceToolDiam = traceTool.fluteDiameter(); let traceToolDiam = traceTool.fluteDiameter();
printPoint = poly2polyEmit(slice.camLines, printPoint, polyEmit, { swapdir: false }); printPoint = poly2polyEmit(slice.camLines, printPoint, polyEmit, {
swapdir: false,
weight: innerFirst
});
newLayer(); newLayer();
} }

View file

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

View file

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

View file

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

View file

@ -790,6 +790,8 @@ self.lang['en-us'] = {
ou_conv_l: ["milling direction","uncheck for 'climb'"], ou_conv_l: ["milling direction","uncheck for 'climb'"],
ou_depf_s: "depth first", ou_depf_s: "depth first",
ou_depf_l: ["optimize pocket cuts","with depth priority"], 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_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_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", ou_forz_s: "force z max",