fix adding cnc ops

This commit is contained in:
Stewart Allen 2024-05-28 18:02:52 -04:00
commit c7456c7736
7 changed files with 313 additions and 276 deletions

View file

@ -274,7 +274,7 @@ CAM.init = function(kiri, api) {
$('op-add-list').onclick = (ev) => {
let settings = API.conf.get();
let { process, device } = settings;
switch (ev.target.innerText) {
switch (ev.target.innerText.toLowerCase()) {
case "index": return func.opAddIndex();
case "laser on": return func.opAddLaserOn();
case "laser off": return func.opAddLaserOff();

View file

@ -39,6 +39,7 @@ gapp.register("kiri.init", [], (root, exports) => {
LASER = [MODES.LASER],
proto = location.protocol,
ver = Date.now().toString(36),
separator = true,
driven = true;
let currentDevice = null,
@ -1646,7 +1647,7 @@ gapp.register("kiri.init", [], (root, exports) => {
context: $('context-menu'),
options: {
area: $('lt-options'),
// area: $('lt-options'),
trash: $('lt-trash'),
enable: $('lt-w-enable'),
disable: $('lt-w-disable'),
@ -1843,7 +1844,7 @@ gapp.register("kiri.init", [], (root, exports) => {
/** FDM Settings */
process: newGroup(LANG.sl_menu, $('fdm-layers'), { modes:FDM, driven }),
process: newGroup(LANG.sl_menu, $('fdm-layers'), { modes:FDM, driven, separator }),
sliceHeight: newInput(LANG.sl_lahi_s, { title:LANG.sl_lahi_l, convert:toFloat }),
sliceMinHeight: newInput(LANG.ad_minl_s, { title:LANG.ad_minl_l, convert:toFloat, bound:bound(0,3.0), show: () => ui.sliceAdaptive.checked}),
sliceShells: newInput(LANG.sl_shel_s, { title:LANG.sl_shel_l, convert:toFloat }),
@ -1854,8 +1855,7 @@ gapp.register("kiri.init", [], (root, exports) => {
separator: newBlank({ class:"set-sep", driven }),
sliceDetectThin: newSelect(LANG.ad_thin_s, { title: LANG.ad_thin_l, action: thinWallSave }, "thin"),
sliceAdaptive: newBoolean(LANG.ad_adap_s, onBooleanClick, {title: LANG.ad_adap_l, trigger: true}),
firstLayer: newGroup(LANG.fl_menu, $('fdm-base'), { modes:FDM, driven }),
firstLayer: newGroup(LANG.fl_menu, $('fdm-base'), { modes:FDM, driven, separator }),
firstSliceHeight: newInput(LANG.fl_lahi_s, {title:LANG.fl_lahi_l, convert:toFloat, show:isNotBelt}),
firstLayerNozzleTemp:newInput(LANG.fl_nozl_s, {title:LANG.fl_nozl_l, convert:toInt, show:isNotBelt}),
firstLayerBedTemp: newInput(LANG.fl_bedd_s, {title:LANG.fl_bedd_l, convert:toInt, show:isNotBelt}),
@ -1878,7 +1878,7 @@ gapp.register("kiri.init", [], (root, exports) => {
separator: newBlank({ class:"set-sep", driven }),
outputRaft: newBoolean(LANG.fr_nabl_s, onBooleanClick, {title:LANG.fr_nabl_l, trigger: true, show:() => isNotBelt()}),
outputDraftShield: newBoolean(LANG.fr_draf_s, onBooleanClick, {title:LANG.fr_draf_l, trigger: true, show:() => isNotBelt()}),
fdmInfill: newGroup(LANG.fi_menu, $('fdm-fill'), { modes:FDM, driven }),
fdmInfill: newGroup(LANG.fi_menu, $('fdm-fill'), { modes:FDM, driven, separator }),
sliceFillType: newSelect(LANG.fi_type, {trigger:true}, "infill"),
sliceFillSparse: newInput(LANG.fi_pcnt_s, {title:LANG.fi_pcnt_l, convert:toFloat, bound:bound(0.0,1.0)}),
sliceFillRepeat: newInput(LANG.fi_rept_s, {title:LANG.fi_rept_l, convert:toInt, bound:bound(1,10), show:fillShow}),
@ -1887,7 +1887,7 @@ gapp.register("kiri.init", [], (root, exports) => {
sliceSolidRate: newInput(LANG.ou_fini_s, {title:LANG.ou_fini_l, convert:toInt, bound:bound(0,500)}),
sliceFillGrow: newInput(LANG.fi_grow_s, {title:LANG.fi_grow_l, convert:toFloat}),
sliceFillAngle: newInput(LANG.fi_angl_s, {title:LANG.fi_angl_l, convert:toFloat}),
fdmSupport: newGroup(LANG.sp_menu, $('fdm-support'), { modes:FDM, marker:false, driven }),
fdmSupport: newGroup(LANG.sp_menu, $('fdm-support'), { modes:FDM, marker:false, driven, separator }),
sliceSupportNozzle: newSelect(LANG.sp_nozl_s, {title:LANG.sp_nozl_l}, "extruders"),
sliceSupportDensity: newInput(LANG.sp_dens_s, {title:LANG.sp_dens_l, convert:toFloat, bound:bound(0.0,1.0)}),
sliceSupportSize: newInput(LANG.sp_size_s, {title:LANG.sp_size_l, convert:toFloat, bound:bound(1.0,200.0)}),
@ -1910,7 +1910,7 @@ gapp.register("kiri.init", [], (root, exports) => {
(ui.ssmDun = newButton(undefined, onButtonClick, {icon:'<i class="fas fa-check"></i>'})),
(ui.ssmClr = newButton(undefined, onButtonClick, {icon:'<i class="fas fa-trash-alt"></i>'}))
], {class:"ext-buttons f-row"}),
fdmOutput: newGroup(LANG.ou_menu, $('fdm-output'), { modes:FDM, driven }),
fdmOutput: newGroup(LANG.ou_menu, $('fdm-output'), { modes:FDM, driven, separator }),
outputTemp: newInput(LANG.ou_nozl_s, {title:LANG.ou_nozl_l, convert:toInt}),
outputBedTemp: newInput(LANG.ou_bedd_s, {title:LANG.ou_bedd_l, convert:toInt}),
outputFanSpeed: newInput(LANG.ou_fans_s, {title:LANG.ou_fans_l, convert:toInt, bound:bound(0,255)}),
@ -1927,7 +1927,7 @@ gapp.register("kiri.init", [], (root, exports) => {
outputAvoidGaps: newBoolean(LANG.ad_agap_s, onBooleanClick, {title:LANG.ad_agap_l}),
outputAlternating: newBoolean(LANG.ad_altr_s, onBooleanClick, {title:LANG.ad_altr_l}),
outputBeltFirst: newBoolean(LANG.ad_lbir_s, onBooleanClick, {title:LANG.ad_lbir_l, show: isBelt}),
fdmExpert: newGroup(LANG.ad_menu, $('fdm-expert'), { modes:FDM, driven }),
fdmExpert: newGroup(LANG.ad_menu, $('fdm-expert'), { modes:FDM, driven, separator }),
outputRetractDist: newInput(LANG.ad_rdst_s, {title:LANG.ad_rdst_l, convert:toFloat}),
outputRetractSpeed: newInput(LANG.ad_rrat_s, {title:LANG.ad_rrat_l, convert:toInt}),
outputRetractWipe: newInput(LANG.ad_wpln_s, {title:LANG.ad_wpln_l, convert:toFloat, bound:bound(0.0,10)}),
@ -1946,7 +1946,7 @@ gapp.register("kiri.init", [], (root, exports) => {
/** CAM Settings */
camTabs: newGroup(LANG.ct_menu, $('cam-tabs'), { modes:CAM, marker:true, driven }),
camTabs: newGroup(LANG.ct_menu, $('cam-tabs'), { modes:CAM, marker:true, driven, separator }),
camTabsWidth: newInput(LANG.ct_wdth_s, {title:LANG.ct_wdth_l, convert:toFloat, bound:bound(0.005,100), units:true}),
camTabsHeight: newInput(LANG.ct_hght_s, {title:LANG.ct_hght_l, convert:toFloat, bound:bound(0.005,100), units:true}),
camTabsDepth: newInput(LANG.ct_dpth_s, {title:LANG.ct_dpth_l, convert:toFloat, bound:bound(0.005,100), units:true}),
@ -1958,7 +1958,7 @@ gapp.register("kiri.init", [], (root, exports) => {
(ui.tabDun = newButton(undefined, onButtonClick, {icon:'<i class="fas fa-check"></i>'})),
(ui.tabClr = newButton(undefined, onButtonClick, {icon:'<i class="fas fa-trash-alt"></i>'}))
], {class:"ext-buttons f-row"}),
camStock: newGroup(LANG.cs_menu, $('cam-stock'), { modes:CAM, driven }),
camStock: newGroup(LANG.cs_menu, $('cam-stock'), { modes:CAM, driven, separator }),
camStockX: newInput(LANG.cs_wdth_s, {title:LANG.cs_wdth_l, convert:toFloat, bound:bound(0,9999), units:true}),
camStockY: newInput(LANG.cs_dpth_s, {title:LANG.cs_dpth_l, convert:toFloat, bound:bound(0,9999), units:true}),
camStockZ: newInput(LANG.cs_hght_s, {title:LANG.cs_hght_l, convert:toFloat, bound:bound(0,9999), units:true}),
@ -1967,7 +1967,7 @@ gapp.register("kiri.init", [], (root, exports) => {
camStockClipTo: newBoolean(LANG.cs_clip_s, onBooleanClick, {title:LANG.cs_clip_l}),
camStockIndexed: newBoolean(LANG.cs_indx_s, onBooleanClick, {title:LANG.cs_indx_l}),
camStockIndexGrid: newBoolean(LANG.cs_ishg_s, onBooleanClick, {title:LANG.cs_ishg_l, show:() => ui.camStockIndexed.checked}),
camLimits: newGroup(LANG.cc_menu, $('cam-limits'), { modes:CAM, driven }),
camLimits: newGroup(LANG.cc_menu, $('cam-limits'), { modes:CAM, driven, separator }),
camZAnchor: newSelect(LANG.ou_zanc_s, {title: LANG.ou_zanc_l, action:zAnchorSave, trace:true, show:() => !ui.camStockIndexed.checked}, "zanchor"),
camZOffset: newInput(LANG.ou_ztof_s, {title:LANG.ou_ztof_l, convert:toFloat, units:true}),
camZBottom: newInput(LANG.ou_zbot_s, {title:LANG.ou_zbot_l, convert:toFloat, units:true, trigger: true}),
@ -1975,43 +1975,43 @@ gapp.register("kiri.init", [], (root, exports) => {
camZClearance: newInput(LANG.ou_zclr_s, {title:LANG.ou_zclr_l, convert:toFloat, bound:bound(0.01,100), units:true}),
camFastFeedZ: newInput(LANG.cc_rzpd_s, {title:LANG.cc_rzpd_l, convert:toFloat, units:true}),
camFastFeed: newInput(LANG.cc_rapd_s, {title:LANG.cc_rapd_l, convert:toFloat, units:true}),
camOutput: newGroup(LANG.ou_menu, $('cam-output'), { modes:CAM, driven }),
camOutput: newGroup(LANG.ou_menu, $('cam-output'), { modes:CAM, driven, separator }),
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}),
camToolInit: newBoolean(LANG.ou_toin_s, onBooleanClick, {title:LANG.ou_toin_l}),
camFirstZMax: newBoolean(LANG.ou_z1st_s, onBooleanClick, {title:LANG.ou_z1st_l}),
camForceZMax: newBoolean(LANG.ou_forz_s, onBooleanClick, {title:LANG.ou_forz_l}),
camOrigin: newGroup(LANG.co_menu, $('cam-origin'), { modes:CAM, driven }),
camOrigin: newGroup(LANG.co_menu, $('cam-origin'), { modes:CAM, driven, separator }),
camOriginOffX: newInput(LANG.co_offx_s, {title:LANG.co_offx_l, convert:toFloat, units:true}),
camOriginOffY: newInput(LANG.co_offy_s, {title:LANG.co_offy_l, convert:toFloat, units:true}),
camOriginOffZ: newInput(LANG.co_offz_s, {title:LANG.co_offz_l, convert:toFloat, units:true}),
separator: newBlank({ class:"set-sep", driven }),
camOriginTop: newBoolean(LANG.or_topp_s, onBooleanClick, {title:LANG.or_topp_l}),
camOriginCenter: newBoolean(LANG.or_cntr_s, onBooleanClick, {title:LANG.or_cntr_l}),
camExpert: newGroup(LANG.op_xprt_s, $('cam-expert'), { group: "cam_expert", modes:CAM, marker: false, driven }),
camExpert: newGroup(LANG.op_xprt_s, $('cam-expert'), { group: "cam_expert", modes:CAM, marker: false, driven, separator }),
camExpertFast: newBoolean(LANG.cx_fast_s, onBooleanClick, {title:LANG.cx_fast_l, show: () => !ui.camTrueShadow.checked }),
camTrueShadow: newBoolean(LANG.cx_true_s, onBooleanClick, {title:LANG.cx_true_l, show: () => !ui.camExpertFast.checked }),
/** LASER Settings */
laserMode: newGroup(LANG.sl_menu, $('lzr-slice'), { modes:LASER, driven }),
laserMode: newGroup(LANG.sl_menu, $('lzr-slice'), { modes:LASER, driven, separator }),
laserOffset: newInput(LANG.ls_offs_s, {title:LANG.ls_offs_l, convert:toFloat}),
laserSliceHeight: newInput(LANG.ls_lahi_s, {title:LANG.ls_lahi_l, convert:toFloat, trigger: true}),
laserSliceHeightMin: newInput(LANG.ls_lahm_s, {title:LANG.ls_lahm_l, convert:toFloat, show:() => { return ui.laserSliceHeight.value == 0 }}),
separator: newBlank({ class:"set-sep", driven }),
laserSliceSingle: newBoolean(LANG.ls_sngl_s, onBooleanClick, {title:LANG.ls_sngl_l}),
laserLayout: newGroup(LANG.lo_menu, $('lzr-layout'), { modes:LASER, driven }),
laserLayout: newGroup(LANG.lo_menu, $('lzr-layout'), { modes:LASER, driven, separator }),
outputTileSpacing: newInput(LANG.ou_spac_s, {title:LANG.ou_spac_l, convert:toInt}),
outputLaserMerged: newBoolean(LANG.ou_mrgd_s, onBooleanClick, {title:LANG.ou_mrgd_l}),
outputLaserGroup: newBoolean(LANG.ou_grpd_s, onBooleanClick, {title:LANG.ou_grpd_l}),
knife: newGroup(LANG.dk_menu, $('lzr-knife'), { modes:LASER, marker:true, driven }),
knife: newGroup(LANG.dk_menu, $('lzr-knife'), { modes:LASER, marker:true, driven, separator }),
outputKnifeDepth: newInput(LANG.dk_dpth_s, {title:LANG.dk_dpth_l, convert:toFloat, bound:bound(0.0,5.0)}),
outputKnifePasses: newInput(LANG.dk_pass_s, {title:LANG.dk_pass_l, convert:toInt, bound:bound(0,5)}),
outputKnifeTip: newInput(LANG.dk_offs_s, {title:LANG.dk_offs_l, convert:toFloat, bound:bound(0.0,10.0)}),
separator: newBlank({ class:"set-sep", driven }),
knifeOn: newBoolean(LANG.enable, onBooleanClick, {title:LANG.ou_drkn_l}),
laserOutput: newGroup(LANG.ou_menu, $('lzr-output'), { modes:LASER, driven }),
laserOutput: newGroup(LANG.ou_menu, $('lzr-output'), { modes:LASER, driven, separator }),
outputLaserPower: newInput(LANG.ou_powr_s, {title:LANG.ou_powr_l, convert:toInt, bound:bound(1,100)}),
outputLaserSpeed: newInput(LANG.ou_sped_s, {title:LANG.ou_sped_l, convert:toInt}),
separator: newBlank({ class:"set-sep", driven }),
@ -2024,34 +2024,34 @@ gapp.register("kiri.init", [], (root, exports) => {
/** SLA SETTINGS */
slaProc: newGroup(LANG.sa_menu, $('sla-slice'), { modes:SLA, group:"sla-slice", driven }),
slaProc: newGroup(LANG.sa_menu, $('sla-slice'), { modes:SLA, group:"sla-slice", driven, separator }),
slaSlice: newInput(LANG.sa_lahe_s, {title:LANG.sa_lahe_l, convert:toFloat}),
slaShell: newInput(LANG.sa_shel_s, {title:LANG.sa_shel_l, convert:toFloat}),
slaOpenTop: newBoolean(LANG.sa_otop_s, onBooleanClick, {title:LANG.sa_otop_l}),
slaOpenBase: newBoolean(LANG.sa_obas_s, onBooleanClick, {title:LANG.sa_obas_l}),
slaLayers: newGroup(LANG.sa_layr_m, $('sla-layers'), { modes:SLA, group:"sla-layers", driven }),
slaLayers: newGroup(LANG.sa_layr_m, $('sla-layers'), { modes:SLA, group:"sla-layers", driven, separator }),
slaLayerOn: newInput(LANG.sa_lton_s, {title:LANG.sa_lton_l, convert:toFloat}),
slaLayerOff: newInput(LANG.sa_ltof_s, {title:LANG.sa_ltof_l, convert:toFloat}),
slaPeelDist: newInput(LANG.sa_pldi_s, {title:LANG.sa_pldi_l, convert:toFloat}),
slaPeelLiftRate: newInput(LANG.sa_pllr_s, {title:LANG.sa_pllr_l, convert:toFloat}),
slaPeelDropRate: newInput(LANG.sa_pldr_s, {title:LANG.sa_pldr_l, convert:toFloat}),
slaBase: newGroup(LANG.sa_base_m, $('sla-base'), { modes:SLA, group:"sla-base", driven }),
slaBase: newGroup(LANG.sa_base_m, $('sla-base'), { modes:SLA, group:"sla-base", driven, separator }),
slaBaseLayers: newInput(LANG.sa_balc_s, {title:LANG.sa_balc_l, convert:toInt}),
slaBaseOn: newInput(LANG.sa_lton_s, {title:LANG.sa_bltn_l, convert:toFloat}),
slaBaseOff: newInput(LANG.sa_ltof_s, {title:LANG.sa_bltf_l, convert:toFloat}),
slaBasePeelDist: newInput(LANG.sa_pldi_s, {title:LANG.sa_pldi_l, convert:toFloat}),
slaBasePeelLiftRate: newInput(LANG.sa_pllr_s, {title:LANG.sa_pllr_l, convert:toFloat}),
slaFill: newGroup(LANG.sa_infl_m, $('sla-fill'), { modes:SLA, group:"sla-infill", driven }),
slaFill: newGroup(LANG.sa_infl_m, $('sla-fill'), { modes:SLA, group:"sla-infill", driven, separator }),
slaFillDensity: newInput(LANG.sa_ifdn_s, {title:LANG.sa_ifdn_l, convert:toFloat, bound:bound(0,1)}),
slaFillLine: newInput(LANG.sa_iflw_s, {title:LANG.sa_iflw_l, convert:toFloat, bound:bound(0,5)}),
slaSupport: newGroup(LANG.sa_supp_m, $('sla-support'), { modes:SLA, group:"sla-support", driven }),
slaSupport: newGroup(LANG.sa_supp_m, $('sla-support'), { modes:SLA, group:"sla-support", driven, separator }),
slaSupportLayers: newInput(LANG.sa_slyr_s, {title:LANG.sa_slyr_l, convert:toInt, bound:bound(5,100)}),
slaSupportGap: newInput(LANG.sa_slgp_s, {title:LANG.sa_slgp_l, convert:toInt, bound:bound(3,30)}),
slaSupportDensity: newInput(LANG.sa_sldn_s, {title:LANG.sa_sldn_l, convert:toFloat, bound:bound(0.01,0.9)}),
slaSupportSize: newInput(LANG.sa_slsz_s, {title:LANG.sa_slsz_l, convert:toFloat, bound:bound(0.1,1)}),
slaSupportPoints: newInput(LANG.sa_slpt_s, {title:LANG.sa_slpt_l, convert:toInt, bound:bound(3,10)}),
slaSupportEnable: newBoolean(LANG.enable, onBooleanClick, {title:LANG.sl_slen_l}),
slaOutput: newGroup(LANG.sa_outp_m, $('sla-output'), { modes:SLA, group:"sla-first", driven }),
slaOutput: newGroup(LANG.sa_outp_m, $('sla-output'), { modes:SLA, group:"sla-first", driven, separator }),
slaFirstOffset: newInput(LANG.sa_opzo_s, {title:LANG.sa_opzo_l, convert:toFloat, bound:bound(0,1)}),
slaAntiAlias: newSelect(LANG.sa_opaa_s, {title:LANG.sa_opaa_l}, "antialias"),

View file

@ -962,8 +962,9 @@ gapp.register("kiri.main", [], (root, exports) => {
}
function setControlsVisible(show) {
$('mid-left').style.display = show ? 'flex' : 'none';
$('mid-right').style.display = show ? 'flex' : 'none';
// TODO fix
// $('mid-left').style.display = show ? 'flex' : 'none';
// $('mid-right').style.display = show ? 'flex' : 'none';
}
function downloadBlob(data, filename) {

View file

@ -234,14 +234,12 @@ function platformUpdateSelected() {
const { device } = settings;
const { extruders } = device;
const { selection, ui } = api;
const { area, enable, disable } = ui.options;
const { enable, disable } = ui.options;
const selreal = selection.widgets();
const selwid = selection.widgets(true);
const selcount = selwid.length;
area.style.display = selreal.length ? 'flex' : '';
if (selcount) {
let enaC = selwid.filter(w => w.meta.disabled !== true).length;
let disC = selwid.filter(w => w.meta.disabled === true).length;

View file

@ -251,6 +251,17 @@ gapp.register("kiri.ui", [], (root, exports) => {
dbkey = `beta-${prefix}-show-${group}`,
link;
// if (opt.separator) {
// const sep = DOC.createElement('div');
// sep.classList.add('set2-sep');
// sep.innerHTML = [
// '<div class="line-sep2"></div>',
// '<div class="chonk"></div>',
// '<div class="line-sep2"></div>',
// ].join('');
// lastDiv.appendChild(sep);
// }
if (opt.class) {
opt.class.split(' ').forEach(ce => {
row.classList.add(ce);
@ -272,6 +283,17 @@ gapp.register("kiri.ui", [], (root, exports) => {
row.appendChild(link);
}
if (opt.separator) {
const sep = DOC.createElement('div');
sep.classList.add('set2-sep');
sep.innerHTML = [
'<div class="line-sep2"></div>',
'<div class="chonk2"></div>',
'<div class="line-sep2"></div>',
].join('');
lastDiv.appendChild(sep);
}
addModeControls(row, opt);
lastGroup = groups[group] = [];
lastGroup.key = dbkey;