add belt layout options to prevent overlapping prints and randomize X axis layout

This commit is contained in:
Stewart Allen 2022-02-08 23:54:20 -05:00
commit 683cb7c9a9
4 changed files with 28 additions and 4 deletions

View file

@ -687,6 +687,7 @@
showSpeeds: true, showSpeeds: true,
freeLayout: true, freeLayout: true,
autoLayout: true, autoLayout: true,
spaceRandoX: false,
spaceLayout: 1, spaceLayout: 1,
units: "mm", units: "mm",
exportOcto: false, exportOcto: false,

View file

@ -170,6 +170,7 @@
control.showRulers = UI.showRulers.checked; control.showRulers = UI.showRulers.checked;
control.autoLayout = UI.autoLayout.checked; control.autoLayout = UI.autoLayout.checked;
control.freeLayout = UI.freeLayout.checked; control.freeLayout = UI.freeLayout.checked;
control.spaceRandoX = UI.spaceRandoX.checked;
control.autoSave = UI.autoSave.checked; control.autoSave = UI.autoSave.checked;
control.antiAlias = UI.antiAlias.checked; control.antiAlias = UI.antiAlias.checked;
control.reverseZoom = UI.reverseZoom.checked; control.reverseZoom = UI.reverseZoom.checked;
@ -496,7 +497,9 @@
if (API.view.get() === VIEWS.ARRANGE) { if (API.view.get() === VIEWS.ARRANGE) {
// auto arrange items on platform // auto arrange items on platform
platform.layout(); platform.layout();
API.space.set_focus(API.selection.widgets()); if (!API.conf.get().controller.spaceRandoX) {
API.space.set_focus(API.selection.widgets());
}
} else { } else {
// go to arrange view // go to arrange view
API.view.set(VIEWS.ARRANGE); API.view.set(VIEWS.ARRANGE);
@ -1717,6 +1720,7 @@
autoSave: UC.newBoolean(LANG.op_save_s, booleanSave, {title:LANG.op_save_l}), autoSave: UC.newBoolean(LANG.op_save_s, booleanSave, {title:LANG.op_save_l}),
autoLayout: UC.newBoolean(LANG.op_auto_s, booleanSave, {title:LANG.op_auto_l}), autoLayout: UC.newBoolean(LANG.op_auto_s, booleanSave, {title:LANG.op_auto_l}),
freeLayout: UC.newBoolean(LANG.op_free_s, booleanSave, {title:LANG.op_free_l}), freeLayout: UC.newBoolean(LANG.op_free_s, booleanSave, {title:LANG.op_free_l}),
spaceRandoX: UC.newBoolean(LANG.op_spcx_s, booleanSave, {title:LANG.op_spcx_l, show:isBelt}),
spaceLayout: UC.newInput(LANG.op_spcr_s, {title:LANG.op_spcr_l, convert:UC.toFloat, size:3, units:true}), spaceLayout: UC.newInput(LANG.op_spcr_s, {title:LANG.op_spcr_l, convert:UC.toFloat, size:3, units:true}),
export: UC.newGroup(LANG.xp_menu, $('prefs-xpo'), {inline: true}), export: UC.newGroup(LANG.xp_menu, $('prefs-xpo'), {inline: true}),
@ -1782,9 +1786,9 @@
outputBrimCount: UC.newInput(LANG.fl_skrt_s, {title:LANG.fl_skrt_l, convert:UC.toInt, modes:FDM, show:isNotBelt}), outputBrimCount: UC.newInput(LANG.fl_skrt_s, {title:LANG.fl_skrt_l, convert:UC.toInt, modes:FDM, show:isNotBelt}),
outputBrimOffset: UC.newInput(LANG.fl_skro_s, {title:LANG.fl_skro_l, convert:UC.toFloat, modes:FDM, show:isNotBelt}), outputBrimOffset: UC.newInput(LANG.fl_skro_s, {title:LANG.fl_skro_l, convert:UC.toFloat, modes:FDM, show:isNotBelt}),
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM, show:isNotBelt}), fdmSep: UC.newBlank({class:"pop-sep", modes:FDM, show:isNotBelt}),
outputDraftShield: UC.newBoolean(LANG.fr_draf_s, onBooleanClick, {title:LANG.fr_draf_l, modes:FDM, trigger: true, show:() => !UI.outputRaft.checked && isNotBelt}), outputDraftShield: UC.newBoolean(LANG.fr_draf_s, onBooleanClick, {title:LANG.fr_draf_l, modes:FDM, trigger: true, show:() => !UI.outputRaft.checked && isNotBelt()}),
outputRaftSpacing: UC.newInput(LANG.fr_spac_s, {title:LANG.fr_spac_l, convert:UC.toFloat, bound:UC.bound(0.0,3.0), modes:FDM, show: () => UI.outputRaft.checked && isNotBelt() }), outputRaftSpacing: UC.newInput(LANG.fr_spac_s, {title:LANG.fr_spac_l, convert:UC.toFloat, bound:UC.bound(0.0,3.0), modes:FDM, show: () => UI.outputRaft.checked && isNotBelt() }),
outputRaft: UC.newBoolean(LANG.fr_nabl_s, onBooleanClick, {title:LANG.fr_nabl_l, modes:FDM, trigger: true, show:() => !UI.outputDraftShield.checked && isNotBelt}), outputRaft: UC.newBoolean(LANG.fr_nabl_s, onBooleanClick, {title:LANG.fr_nabl_l, modes:FDM, trigger: true, show:() => !UI.outputDraftShield.checked && isNotBelt()}),
fdmInfill: UC.newGroup(LANG.fi_menu, $('settings'), {modes:FDM}), fdmInfill: UC.newGroup(LANG.fi_menu, $('settings'), {modes:FDM}),
sliceFillType: UC.newSelect(LANG.fi_type, {modes:FDM, trigger:true}, "infill"), sliceFillType: UC.newSelect(LANG.fi_type, {modes:FDM, trigger:true}, "infill"),
@ -2536,6 +2540,7 @@
UI.showSpeeds.checked = control.showSpeeds; UI.showSpeeds.checked = control.showSpeeds;
UI.freeLayout.checked = control.freeLayout; UI.freeLayout.checked = control.freeLayout;
UI.autoLayout.checked = control.autoLayout; UI.autoLayout.checked = control.autoLayout;
UI.spaceRandoX.checked = control.spaceRandoX;
UI.antiAlias.checked = control.antiAlias; UI.antiAlias.checked = control.antiAlias;
UI.reverseZoom.checked = control.reverseZoom; UI.reverseZoom.checked = control.reverseZoom;
UI.autoSave.checked = control.autoSave; UI.autoSave.checked = control.autoSave;

View file

@ -2273,6 +2273,7 @@
function platformLayout(event, space = settings.controller.spaceLayout) { function platformLayout(event, space = settings.controller.spaceLayout) {
let auto = UI.autoLayout.checked, let auto = UI.autoLayout.checked,
ctrl = settings.controller,
proc = settings.process, proc = settings.process,
dev = settings.device, dev = settings.device,
isBelt = dev.bedBelt, isBelt = dev.bedBelt,
@ -2356,6 +2357,21 @@
widget.move(0, movey, 0); widget.move(0, movey, 0);
} }
}); });
if (ctrl.spaceLayout === 0) {
let sum = 0;
let sorted = WIDGETS.sort((a,b) => a.track.pos.y - b.track.pos.y);
sorted.forEach(w => {
w.move(0, sum, 0);
sum += w.track.box.d + 1;
});
}
if (ctrl.spaceRandoX) {
for (let w of WIDGETS) {
w.move(
(0.5 - Math.random()) * (dev.bedWidth - w.track.box.w - proc.firstLayerBrim),
0, 0);
}
}
} }
platform.update_origin(); platform.update_origin();

View file

@ -252,7 +252,9 @@ kiri.lang['en-us'] = {
op_free_s: "free layout", op_free_s: "free layout",
op_free_l: ["permit dragable layout","no effect in laser mode"], op_free_l: ["permit dragable layout","no effect in laser mode"],
op_spcr_s: "spacing", op_spcr_s: "spacing",
op_spcr_l: ["spacing between objects","during auto layout","in workspace units"], op_spcr_l: ["spacing between objects","during auto layout","in workspace units","in belt mode, use 0","to auto-space by height"],
op_spcx_s: "random X",
op_spcx_l: ["in belt mode, randomly","layout the part on X","to even belt wear"],
op_orth_s: "orthographic", op_orth_s: "orthographic",
op_orth_l: ["orthographic display","requires page refresh"], op_orth_l: ["orthographic display","requires page refresh"],
op_anta_s: "anti-alias", op_anta_s: "anti-alias",