stub in support client/worker generator functions

This commit is contained in:
Stewart Allen 2020-12-14 12:52:08 -05:00
commit c191e8bc04
8 changed files with 36 additions and 15 deletions

2
app.js
View file

@ -271,6 +271,7 @@ const script = {
"kiri/db", "kiri/db",
"kiri/slice", "kiri/slice",
"kiri/layers", "kiri/layers",
"kiri/client",
"mode/fdm/driver", "mode/fdm/driver",
"mode/fdm/client", "mode/fdm/client",
"mode/sla/driver", "mode/sla/driver",
@ -285,7 +286,6 @@ const script = {
"kiri/widget", "kiri/widget",
"kiri/print", "kiri/print",
"kiri/codec", "kiri/codec",
"kiri/client",
"kiri/conf", "kiri/conf",
"kiri/main", "kiri/main",
"kiri/init", "kiri/init",

View file

@ -13,8 +13,6 @@
# - redo automatic supports using faces instead of deltas # - redo automatic supports using faces instead of deltas
# - bind process to z ranges or boxed regions # - bind process to z ranges or boxed regions
# - non-planar actual # - non-planar actual
# `all`
# - improve device list, selection, management, customization
## `C` cosmetic, `F` functional, `P` performance, `B` bug fix ## `C` cosmetic, `F` functional, `P` performance, `B` bug fix

View file

@ -1619,6 +1619,9 @@
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}), fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}),
sliceSupportSpan: UC.newInput(LANG.sp_span_s, {title:LANG.sp_span_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM, show: () => UI.sliceSupportEnable.checked}), sliceSupportSpan: UC.newInput(LANG.sp_span_s, {title:LANG.sp_span_l, bound:UC.bound(0.0,200.0), convert:UC.toFloat, modes:FDM, show: () => UI.sliceSupportEnable.checked}),
sliceSupportEnable: UC.newBoolean(LANG.sp_auto_s, onBooleanClick, {title: LANG.sp_auto_l, modes:FDM, trigger:true}), sliceSupportEnable: UC.newBoolean(LANG.sp_auto_s, onBooleanClick, {title: LANG.sp_auto_l, modes:FDM, trigger:true}),
// sliceSupportGen: UC.newRow([
// UI.ssaGen = UC.newButton('detect', onButtonClick)
// ], { modes: FDM }),
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}), fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}),
sliceSupportManual: UC.newRow([ sliceSupportManual: UC.newRow([

View file

@ -266,7 +266,7 @@
func.tabDone(); func.tabDone();
alert = api.show.alert("analyzing parts...", 1000); alert = api.show.alert("analyzing parts...", 1000);
traceOn = true; traceOn = true;
KIRI.client.traces((ids) => { CAM.traces((ids) => {
api.hide.alert(alert); api.hide.alert(alert);
alert = api.show.alert("[esc] key cancels trace editing"); alert = api.show.alert("[esc] key cancels trace editing");
KIRI.api.widgets.opacity(0.5); KIRI.api.widgets.opacity(0.5);

View file

@ -25,11 +25,11 @@
KIRI.loader.push(function(API) { KIRI.loader.push(function(API) {
if (KIRI.client) if (KIRI.client)
KIRI.client.traces = function(ondone) { CAM.traces = function(ondone) {
KIRI.client.sync(); KIRI.client.sync();
let settings = API.conf.get(); let settings = API.conf.get();
let widgets = API.widgets.map(); let widgets = API.widgets.map();
send("traces", { settings }, output => { send("cam_traces", { settings }, output => {
let ids = []; let ids = [];
KIRI.codec.decode(output).forEach(rec => { KIRI.codec.decode(output).forEach(rec => {
ids.push(rec.id); ids.push(rec.id);
@ -41,7 +41,7 @@
}; };
if (KIRI.worker) if (KIRI.worker)
KIRI.worker.traces = function(data, send) { KIRI.worker.cam_traces = function(data, send) {
const { settings } = data; const { settings } = data;
const widgets = Object.values(cache); const widgets = Object.values(cache);
const fresh = widgets.filter(widget => CAM.traces(settings, widget)); const fresh = widgets.filter(widget => CAM.traces(settings, widget));

View file

@ -39,17 +39,21 @@
}); });
api.event.on("button.click", target => { api.event.on("button.click", target => {
switch (target) { switch (target) {
case api.ui.ssmAdd: case api.ui.ssaGen: return func.sgen();
return func.sadd(); case api.ui.ssmAdd: return func.sadd();
case api.ui.ssmDun: case api.ui.ssmDun: return func.sdone();
return func.sdone();
case api.ui.ssmClr: case api.ui.ssmClr:
api.uc.confirm("clear supports?").then(ok => { return api.uc.confirm("clear supports?").then(ok => {
if (ok) func.sclear(); if (ok) func.sclear();
}); });
break;
} }
}); });
api.event.on("fdm.supports.gen", func.sgen = () => {
alert = api.show.alert("analyzing part...", 1000);
FDM.support_generate(done => {
api.hide.alert(alert);
});
});
api.event.on("fdm.supports.add", func.sadd = () => { api.event.on("fdm.supports.add", func.sadd = () => {
alert = api.show.alert("[esc] key cancels support editing"); alert = api.show.alert("[esc] key cancels support editing");
api.feature.hover = true; api.feature.hover = true;

View file

@ -33,4 +33,20 @@
return btoa("; filename = kirimoto.gcode\n; machine = dv1MW0A000\n" + gcode); return btoa("; filename = kirimoto.gcode\n; machine = dv1MW0A000\n" + gcode);
}; };
// defer loading until KIRI.client and KIRI.worker exist
KIRI.loader.push(function(API) {
if (KIRI.client)
// FDM.support_generate = KIRI.client.fdm_support_generate = function(ondone) {
FDM.support_generate = function(ondone) {
send('fdm_support_generate', {}, ondone);
};
if (KIRI.worker)
KIRI.worker.fdm_support_generate = function(data, send) {
send.done();
};
});
})(); })();

View file

@ -249,7 +249,7 @@
</div> </div>
<div id="mod-setup" class="mdialog f-row"> <div id="mod-setup" class="mdialog f-row">
<div class="f-col left a-stretch"> <div class="f-col left a-stretch">
<label class="header">select device type</label> <label class="header">select a device type</label>
<div class="f-col"> <div class="f-col">
<table><tr> <table><tr>
<th><button id="mode-fdm" class="dev-type"><label>FDM</label></button></th> <th><button id="mode-fdm" class="dev-type"><label>FDM</label></button></th>
@ -276,7 +276,7 @@
</div> </div>
</div> </div>
<div class="f-col grow a-stretch"> <div class="f-col grow a-stretch">
<label class="header">details of selected device</label> <label class="header">selected device</label>
<div class="f-row"> <div class="f-row">
<div id="device1" class="f-col t-body t-inset overy grow"></div> <div id="device1" class="f-col t-body t-inset overy grow"></div>
<div class="t-pad"></div> <div class="t-pad"></div>