add cam origin selector. fix wasm newpoly
This commit is contained in:
parent
2ddd07eecf
commit
5532cf28e4
12 changed files with 277 additions and 132 deletions
|
|
@ -6,7 +6,7 @@ import STACKS from './stacks.js';
|
|||
|
||||
import { broker } from '../../moto/broker.js';
|
||||
import { client as work } from './client.js';
|
||||
import { consts, COLOR as color, LISTS as lists, MODES, VIEWS, PATHS } from './consts.js';
|
||||
import { consts, COLOR as color, LISTS as lists } from './consts.js';
|
||||
import { device, devices } from './devices.js';
|
||||
import { catalog, dialog, event, group, help, hide, image } from './main.js';
|
||||
import { modal, mode, probe, process, show, space, util, view } from './main.js';
|
||||
|
|
|
|||
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
import { api } from './api.js';
|
||||
import { noop } from './utils.js';
|
||||
import { codec } from './codec.js';
|
||||
import { Widget } from './widget.js';
|
||||
import { newPrint } from './print.js';
|
||||
|
||||
// this code runs in kiri's main loop
|
||||
let debug = self.debug === true,
|
||||
|
|
@ -199,7 +202,7 @@ export const client = {
|
|||
send("rotate", { settings }, reply => {
|
||||
if (reply.group) {
|
||||
// collect post-rotation data for slice/preview renders
|
||||
for (let widget of kiri.Widget.Groups.forid(reply.group)) {
|
||||
for (let widget of Widget.Groups.forid(reply.group)) {
|
||||
widget.belt = reply.belt;
|
||||
}
|
||||
} else if (callback) {
|
||||
|
|
@ -280,10 +283,10 @@ export const client = {
|
|||
y: -origin.y,
|
||||
z: origin.z
|
||||
};
|
||||
const output = kiri.newPrint().parseSVG(code, offset);
|
||||
const output = newPrint().parseSVG(code, offset);
|
||||
send("parse_svg", output, reply => {
|
||||
if (reply.parsed) {
|
||||
done(kiri.codec.decode(reply.parsed));
|
||||
done(codec.decode(reply.parsed));
|
||||
}
|
||||
});
|
||||
return;
|
||||
|
|
@ -293,7 +296,7 @@ export const client = {
|
|||
progress(reply.progress);
|
||||
}
|
||||
if (reply.parsed) {
|
||||
done(kiri.codec.decode(reply.parsed), reply.maxSpeed, reply.minSpeed);
|
||||
done(codec.decode(reply.parsed), reply.maxSpeed, reply.minSpeed);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import { init as initLaser } from '../mode/laser/client.js';
|
|||
import { init as initSLA } from '../mode/sla/client.js';
|
||||
import { init as initWEDM } from '../mode/wedm/client.js';
|
||||
import { init as initWJET } from '../mode/wjet/client.js';
|
||||
import { menu as menuCAM } from '../mode/cam/init-menu.js';
|
||||
|
||||
let { CAM, SLA, FDM, LASER, DRAG, WJET, WEDM } = MODES,
|
||||
{ client, catalog, platform, selection, stats } = api,
|
||||
|
|
@ -123,11 +124,6 @@ function speedSave() {
|
|||
api.view.update_speeds();
|
||||
}
|
||||
|
||||
function zAnchorSave() {
|
||||
api.conf.update();
|
||||
api.platform.update_top_z();
|
||||
}
|
||||
|
||||
function setThreaded(bool) {
|
||||
if (bool) {
|
||||
client.pool.start();
|
||||
|
|
@ -234,6 +230,8 @@ function onBooleanClick(el) {
|
|||
api.devices.update_laser_state();
|
||||
}
|
||||
|
||||
api.event.on('click.boolean', onBooleanClick);
|
||||
|
||||
function onButtonClick(ev) {
|
||||
let target = ev.target;
|
||||
while (target && target.tagName !== 'BUTTON') {
|
||||
|
|
@ -242,6 +240,8 @@ function onButtonClick(ev) {
|
|||
api.event.emit("button.click", target);
|
||||
}
|
||||
|
||||
api.event.on('click.button', onButtonClick);
|
||||
|
||||
function inputHasFocus() {
|
||||
let active = DOC.activeElement;
|
||||
return active && (active.nodeName === "INPUT" || active.nodeName === "TEXTAREA");
|
||||
|
|
@ -1229,61 +1229,7 @@ function init_one() {
|
|||
fdmRanges: $('fdm-ranges'),
|
||||
|
||||
/** CAM Settings */
|
||||
|
||||
_____: 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}),
|
||||
camTabsHeight: newInput(LANG.ct_hght_s, {title:LANG.ct_hght_l, convert:toFloat, bound:bound(0.005,100), units}),
|
||||
camTabsDepth: newInput(LANG.ct_dpth_s, {title:LANG.ct_dpth_l, convert:toFloat, bound:bound(0.005,100), units}),
|
||||
separator: newBlank({ class:"set-sep", driven }),
|
||||
camTabsMidline: newBoolean(LANG.ct_midl_s, onBooleanClick, {title:LANG.ct_midl_l}),
|
||||
separator: newBlank({ class:"set-sep", driven }),
|
||||
camTabsManual: newRow([
|
||||
(ui.tabAdd = newButton(undefined, onButtonClick, {icon:'<i class="fas fa-plus"></i>'})),
|
||||
(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"}),
|
||||
_____: 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}),
|
||||
camStockY: newInput(LANG.cs_dpth_s, {title:LANG.cs_dpth_l, convert:toFloat, bound:bound(0,9999), units}),
|
||||
camStockZ: newInput(LANG.cs_hght_s, {title:LANG.cs_hght_l, convert:toFloat, bound:bound(0,9999), units}),
|
||||
separator: newBlank({ class:"set-sep", driven }),
|
||||
camStockOffset: newBoolean(LANG.cs_offs_s, onBooleanClick, {title:LANG.cs_offs_l}),
|
||||
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}),
|
||||
_____: newGroup(LANG.cc_menu, $('cam-limits'), { modes:CAM, driven, separator }),
|
||||
camZAnchor: newSelect(LANG.ou_zanc_s, {title: LANG.ou_zanc_l, action:zAnchorSave, show:() => !ui.camStockIndexed.checked}, "zanchor"),
|
||||
camZOffset: newInput(LANG.ou_ztof_s, {title:LANG.ou_ztof_l, convert:toFloat, units}),
|
||||
camZTop: newInput(LANG.ou_ztop_s, {title:LANG.ou_ztop_l, convert:toFloat, units, trigger}),
|
||||
camZBottom: newInput(LANG.ou_zbot_s, {title:LANG.ou_zbot_l, convert:toFloat, units, trigger}),
|
||||
camZThru: newInput(LANG.ou_ztru_s, {title:LANG.ou_ztru_l, convert:toFloat, bound:bound(0.0,100), units }),
|
||||
camZClearance: newInput(LANG.ou_zclr_s, {title:LANG.ou_zclr_l, convert:toFloat, bound:bound(0.01,100), units }),
|
||||
camFastFeedZ: newInput(LANG.cc_rzpd_s, {title:LANG.cc_rzpd_l, convert:toFloat, units}),
|
||||
camFastFeed: newInput(LANG.cc_rapd_s, {title:LANG.cc_rapd_l, convert:toFloat, units}),
|
||||
_____: newGroup(LANG.ou_menu, $('cam-output'), { modes:CAM, driven, separator, group:"cam-output" }),
|
||||
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}),
|
||||
separator: newBlank({ class:"set-sep", driven }),
|
||||
camFirstZMax: newBoolean(LANG.ou_z1st_s, onBooleanClick, {title:LANG.ou_z1st_l}),
|
||||
camForceZMax: newBoolean(LANG.ou_forz_s, onBooleanClick, {title:LANG.ou_forz_l}),
|
||||
separator: newBlank({ class:"set-sep", driven }),
|
||||
camEaseAngle: newInput(LANG.ou_eang_s, {title:LANG.ou_eang_l, convert:toFloat, bound:bound(0.1,85), show:() => ui.camEaseDown.checked}),
|
||||
camFullEngage: newInput(LANG.ou_feng_s, {title:LANG.ou_feng_l, convert:toFloat, bound:bound(0.1,1.0)}),
|
||||
_____: newGroup(LANG.co_menu, $('cam-origin'), { modes:CAM, driven, separator }),
|
||||
camOriginTop: newBoolean(LANG.or_topp_s, onBooleanClick, {title:LANG.or_topp_l}),
|
||||
camOriginCenter: newBoolean(LANG.or_cntr_s, onBooleanClick, {title:LANG.or_cntr_l}),
|
||||
separator: newBlank({ class:"set-sep", driven }),
|
||||
camOriginOffX: newInput(LANG.co_offx_s, {title:LANG.co_offx_l, convert:toFloat, units}),
|
||||
camOriginOffY: newInput(LANG.co_offy_s, {title:LANG.co_offy_l, convert:toFloat, units}),
|
||||
camOriginOffZ: newInput(LANG.co_offz_s, {title:LANG.co_offz_l, convert:toFloat, units}),
|
||||
_____: 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 }),
|
||||
separator: newBlank({ class:"set-sep", driven }),
|
||||
camArcTolerance: newInput(LANG.cx_arct_s, {title:LANG.cx_arct_l, convert:toFloat, units, bound:bound(0,100)}),
|
||||
camArcResolution: newInput(LANG.cx_arcr_s, {title:LANG.cx_arcr_l, convert:toFloat, bound:bound(0,180), show:() => ui.camArcTolerance.value > 0}),
|
||||
...menuCAM(),
|
||||
|
||||
/** LASER/DRAG/WJET/WEDM cut tool Settings */
|
||||
|
||||
|
|
@ -1367,6 +1313,8 @@ function init_one() {
|
|||
});
|
||||
|
||||
// run client mode initializations right after UI is bound
|
||||
// MUST run after main ui menu inits since they rely on passed state
|
||||
// that createPopOps disrupts (should be refactored)
|
||||
initCAM();
|
||||
initDRAG();
|
||||
initFDM();
|
||||
|
|
|
|||
Loading…
Reference in a new issue