split dragknife out of laser and create new mode based on it. template for waterjet and wire-edm
This commit is contained in:
parent
f164353dd1
commit
85f48ef9b4
12 changed files with 137 additions and 56 deletions
21
src/kiri-dev/drag/Any.Generic.DragKnife
Normal file
21
src/kiri-dev/drag/Any.Generic.DragKnife
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"file-ext": "gcode",
|
||||
"token-space": " ",
|
||||
"pre":[
|
||||
"G21 ; set units to MM (required)",
|
||||
"G90 ; absolute position mode (required)"
|
||||
],
|
||||
"post":[
|
||||
"M30 ; program end"
|
||||
],
|
||||
"laser-on":[
|
||||
"M106 S{power}"
|
||||
],
|
||||
"laser-off":[
|
||||
"M107"
|
||||
],
|
||||
"settings": {
|
||||
"bed_width": 300,
|
||||
"bed_depth": 300
|
||||
}
|
||||
}
|
||||
16
src/kiri-mode/drag/driver.js
Normal file
16
src/kiri-mode/drag/driver.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/** Copyright Stewart Allen <sa@grid.space> -- All Rights Reserved */
|
||||
|
||||
"use strict";
|
||||
|
||||
// dep: geo.polygons
|
||||
// dep: geo.point
|
||||
// dep: kiri.slice
|
||||
// dep: kiri-mode.laser.driver
|
||||
// use: kiri.pack
|
||||
// use: kiri.render
|
||||
gapp.register("kiri-mode.drag.driver", [], (root, exports) => {
|
||||
|
||||
root.kiri.driver.DRAG = root.kiri.driver.LASER;
|
||||
|
||||
});
|
||||
|
||||
|
|
@ -14,7 +14,7 @@ const { driver, newSlice } = kiri;
|
|||
const { polygons, newPoint } = base;
|
||||
|
||||
const POLY = polygons;
|
||||
const LASER = driver.LASER = {
|
||||
const DRIVER = driver.LASER = {
|
||||
init,
|
||||
slice,
|
||||
prepare,
|
||||
|
|
@ -181,9 +181,7 @@ async function prepare(widgets, settings, update) {
|
|||
let device = settings.device,
|
||||
process = settings.process,
|
||||
print = self.worker.print = kiri.newPrint(settings, widgets),
|
||||
knifeOn = process.knifeOn,
|
||||
// knifeDepth = process.outputKnifeDepth,
|
||||
// knifePasses = process.outputKnifePasses,
|
||||
knifeOn = self.worker.mode === 'DRAG',
|
||||
knifeTipOff = process.outputKnifeTip,
|
||||
output = print.output = [],
|
||||
totalSlices = 0,
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@
|
|||
// use: kiri-mode.fdm.prepare
|
||||
// use: kiri-mode.fdm.export
|
||||
// use: kiri-mode.laser.driver
|
||||
// use: kiri-mode.drag.driver
|
||||
gapp.register("kiri-run.worker", [], (root, exports) => {
|
||||
|
||||
const { base, kiri, moto } = root;
|
||||
|
|
@ -40,7 +41,8 @@ let debug = self.debug === true,
|
|||
concurrent = self.Worker && ccvalue > 3 ? ccvalue - 1 : 0,
|
||||
current = self.worker = {
|
||||
print: null,
|
||||
snap: null
|
||||
snap: null,
|
||||
mode: null
|
||||
},
|
||||
wgroup = {},
|
||||
wcache = {},
|
||||
|
|
@ -401,13 +403,14 @@ kiri.worker = {
|
|||
slice(data, send) {
|
||||
send.data({update:0.001, updateStatus:"slicing"});
|
||||
|
||||
current.print = null;
|
||||
|
||||
let settings = data.settings,
|
||||
widget = wcache[data.id],
|
||||
last = time(),
|
||||
now;
|
||||
|
||||
current.print = null;
|
||||
current.mode = settings.mode.toUpperCase();
|
||||
|
||||
widget.anno = data.anno || widget.anno;
|
||||
|
||||
widget.slice(settings, function(error) {
|
||||
|
|
|
|||
|
|
@ -644,8 +644,49 @@ const conf = exports({
|
|||
outputInvertY: false,
|
||||
outputKnifeDepth: 1,
|
||||
outputKnifePasses: 1,
|
||||
outputKnifeTip: 2,
|
||||
knifeOn: false
|
||||
outputKnifeTip: 2
|
||||
}
|
||||
},
|
||||
drag: {
|
||||
// device defaults Drag:Device
|
||||
d:{
|
||||
new: true,
|
||||
mode: "",
|
||||
deviceName: "",
|
||||
imageURL: "",
|
||||
internal: 0,
|
||||
bedWidth: 300,
|
||||
bedDepth: 200,
|
||||
bedHeight: 2.5,
|
||||
maxHeight: 100,
|
||||
gcodePre: [],
|
||||
gcodePost: [],
|
||||
gcodeFExt: "",
|
||||
gcodeSpace: true,
|
||||
gcodeLaserOn: ["M106 S{power}"],
|
||||
gcodeLaserOff: ["M107"]
|
||||
},
|
||||
// process defaults Drag:Process
|
||||
p:{
|
||||
processName: "default",
|
||||
laserOffset: 0.1,
|
||||
laserSliceHeight: 1,
|
||||
laserSliceHeightMin: 0,
|
||||
laserSliceSingle: true,
|
||||
outputTileSpacing: 1,
|
||||
outputLaserPower: 100,
|
||||
outputLaserSpeed: 1000,
|
||||
outputLaserGroup: true,
|
||||
outputLaserZColor: false,
|
||||
outputLaserLayer: false,
|
||||
outputLaserStack: false,
|
||||
outputLaserMerged: false,
|
||||
outputOriginCenter: true,
|
||||
outputInvertX: false,
|
||||
outputInvertY: false,
|
||||
outputKnifeDepth: 1,
|
||||
outputKnifePasses: 1,
|
||||
outputKnifeTip: 2
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
@ -731,28 +772,32 @@ const conf = exports({
|
|||
FDM: "default",
|
||||
SLA: "default",
|
||||
CAM: "default",
|
||||
LASER: "default"
|
||||
LASER: "default",
|
||||
DRAG: "default",
|
||||
},
|
||||
// stored processes by mode
|
||||
sproc:{
|
||||
FDM: {},
|
||||
SLA: {},
|
||||
CAM: {},
|
||||
LASER: {}
|
||||
LASER: {},
|
||||
DRAG: {},
|
||||
},
|
||||
// current device name by mode
|
||||
filter:{
|
||||
FDM: "Any.Generic.Marlin",
|
||||
SLA: "Anycubic.Photon",
|
||||
CAM: "Any.Generic.Grbl",
|
||||
LASER: "Any.Generic.Laser"
|
||||
LASER: "Any.Generic.Laser",
|
||||
DRAG: "Any.Generic.Laser",
|
||||
},
|
||||
// stored device by mode
|
||||
cdev: {
|
||||
FDM: null,
|
||||
SLA: null,
|
||||
CAM: null,
|
||||
LASER: null
|
||||
LASER: null,
|
||||
DRAG: null,
|
||||
},
|
||||
// custom devices by name (all modes)
|
||||
devices:{},
|
||||
|
|
|
|||
|
|
@ -123,16 +123,19 @@ const LISTS = {
|
|||
|
||||
// primary device mode
|
||||
const MODES = {
|
||||
FDM: 1, // fused deposition modeling (also FFF)
|
||||
LASER: 2, // laser cutters
|
||||
CAM: 3, // 3 axis milling/machining
|
||||
SLA: 4 // cured resin printers
|
||||
FDM: 1, // fused deposition modeling (also FFF)
|
||||
LASER: 2, // laser cutters (base for all 2d device types)
|
||||
CAM: 3, // 3 axis milling/machining
|
||||
SLA: 4, // cured resin printers
|
||||
DRAG: 5, // drag knife (a variation on laser / 2d)
|
||||
WJET: 6, // waterjet (a varation on laser / 2d)
|
||||
WEDM: 7 // wire-edm (a variation on laser / 2d)
|
||||
};
|
||||
|
||||
// view mode within device mode
|
||||
const VIEWS = {
|
||||
ARRANGE: 1,
|
||||
SLICE: 2,
|
||||
SLICE: 2,
|
||||
PREVIEW: 3,
|
||||
ANIMATE: 4
|
||||
};
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ function exportFile(options) {
|
|||
.map(v => v.split('.')[0]);
|
||||
api.event.emit('export', mode);
|
||||
switch (mode) {
|
||||
case 'DRAG':
|
||||
case 'LASER': return callExportLaser(options, names);
|
||||
case 'FDM': return callExport(options, mode, names);
|
||||
case 'CAM': return callExport(options, mode, names);
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
// dep: kiri-mode.fdm.client
|
||||
// dep: kiri-mode.sla.client
|
||||
// dep: kiri-mode.laser.driver
|
||||
// dep: kiri-mode.drag.driver
|
||||
gapp.register("kiri.function", [], (root, exports) => {
|
||||
|
||||
const { kiri } = root;
|
||||
|
|
|
|||
|
|
@ -22,18 +22,15 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
|
||||
const WIN = self.window,
|
||||
DOC = self.document,
|
||||
DEG2RAD = Math.PI / 180,
|
||||
STARTMODE = SETUP.sm && SETUP.sm.length === 1 ? SETUP.sm[0] : null,
|
||||
DEG2RAD = Math.PI/180,
|
||||
CAM = [MODES.CAM],
|
||||
SLA = [MODES.SLA],
|
||||
FDM = [MODES.FDM],
|
||||
FDM_CAM = [MODES.FDM,MODES.CAM],
|
||||
FDM_SLA = [MODES.FDM,MODES.SLA],
|
||||
FDM_LZR = [MODES.LASER,MODES.FDM],
|
||||
FDM_CAM_SLA = [MODES.CAM,MODES.FDM,MODES.SLA],
|
||||
CAM_LZR = [MODES.LASER,MODES.CAM],
|
||||
GCODE = [MODES.FDM, MODES.LASER, MODES.CAM],
|
||||
LASER = [MODES.LASER],
|
||||
{ CAM, SLA, FDM, LASER, DRAG, WJET, WEDM } = MODES,
|
||||
TWOD = [LASER, DRAG, WJET, WEDM],
|
||||
THREED = [FDM, CAM, SLA],
|
||||
GCODE = [FDM, CAM, ...TWOD],
|
||||
CAM_LZR = [CAM, ...TWOD],
|
||||
FDM_LZR = [FDM, ...TWOD],
|
||||
FDM_CAM = [FDM, CAM],
|
||||
proto = location.protocol,
|
||||
ver = Date.now().toString(36),
|
||||
separator = true,
|
||||
|
|
@ -1323,6 +1320,8 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
api.show.tools = showTools;
|
||||
|
||||
function getModeDevices() {
|
||||
// devices are injected into self scope by
|
||||
// app.js generateDevices()
|
||||
return Object.keys(devices[api.mode.get_lower()]).sort();
|
||||
}
|
||||
|
||||
|
|
@ -1768,8 +1767,8 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
_____: newGroup(LANG.pt_menu, $('prefs-prt'), {inline: true}),
|
||||
detail: newSelect(LANG.pt_qual_s, {title: LANG.pt_qual_l, action: detailSave}, "detail"),
|
||||
healMesh: newBoolean(LANG.pt_heal_s, booleanSave, {title: LANG.pt_heal_l}),
|
||||
threaded: newBoolean(LANG.pt_thrd_s, booleanSave, {title: LANG.pt_thrd_l, modes:FDM_CAM_SLA}),
|
||||
assembly: newBoolean(LANG.pt_assy_s, booleanSave, {title: LANG.pt_assy_l, modes:FDM_CAM_SLA}),
|
||||
threaded: newBoolean(LANG.pt_thrd_s, booleanSave, {title: LANG.pt_thrd_l, modes:THREED}),
|
||||
assembly: newBoolean(LANG.pt_assy_s, booleanSave, {title: LANG.pt_assy_l, modes:THREED}),
|
||||
|
||||
prefadd: uc.checkpoint($('prefs-add')),
|
||||
|
||||
|
|
@ -1940,23 +1939,21 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
|
||||
/** LASER Settings */
|
||||
|
||||
laserMode: newGroup(LANG.sl_menu, $('lzr-slice'), { modes:LASER, driven, separator }),
|
||||
laserMode: newGroup(LANG.sl_menu, $('lzr-slice'), { modes:TWOD, 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:() => ui.laserSliceHeight.value == 0 && !ui.laserSliceSingle.checked }),
|
||||
separator: newBlank({ class:"set-sep", driven }),
|
||||
laserSliceSingle: newBoolean(LANG.ls_sngl_s, onBooleanClick, {title:LANG.ls_sngl_l}),
|
||||
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), show:() => ui.knifeOn.checked }),
|
||||
outputKnifePasses: newInput(LANG.dk_pass_s, {title:LANG.dk_pass_l, convert:toInt, bound:bound(0,5), show:() => ui.knifeOn.checked}),
|
||||
outputKnifeTip: newInput(LANG.dk_offs_s, {title:LANG.dk_offs_l, convert:toFloat, bound:bound(0.0,10.0), show:() => ui.knifeOn.checked}),
|
||||
separator: newBlank({ class:"set-sep", driven, show:() => ui.knifeOn.checked }),
|
||||
knifeOn: newBoolean(LANG.enable, onBooleanClick, {title:LANG.ou_drkn_l}),
|
||||
laserLayout: newGroup(LANG.lo_menu, $('lzr-layout'), { modes:LASER, driven, separator }),
|
||||
knife: newGroup(LANG.dk_menu, $('lzr-knife'), { modes:DRAG, 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) }),
|
||||
laserLayout: newGroup(LANG.lo_menu, $('lzr-layout'), { modes:TWOD, 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, show:() => !ui.outputLaserStack.checked}),
|
||||
laserOutput: newGroup(LANG.ou_menu, $('lzr-output'), { modes:LASER, driven, separator }),
|
||||
laserOutput: newGroup(LANG.ou_menu, $('lzr-output'), { modes:TWOD, 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 }),
|
||||
|
|
@ -2645,6 +2642,7 @@ gapp.register("kiri.init", [], (root, exports) => {
|
|||
$('mode-cam').onclick = () => api.mode.set('CAM');
|
||||
$('mode-sla').onclick = () => api.mode.set('SLA');
|
||||
$('mode-laser').onclick = () => api.mode.set('LASER');
|
||||
$('mode-drag').onclick = () => api.mode.set('DRAG');
|
||||
$('set-device').onclick = (ev) => { ev.stopPropagation(); showDevices() };
|
||||
$('set-profs').onclick = (ev) => { ev.stopPropagation(); api.conf.show() };
|
||||
$('set-tools').onclick = (ev) => { ev.stopPropagation(); showTools() };
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ gapp.register("kiri.main", [], (root, exports) => {
|
|||
is_cam() { return MODE === MODES.CAM },
|
||||
is_sla() { return MODE === MODES.SLA },
|
||||
is_laser() { return MODE === MODES.LASER },
|
||||
is_drag() { return MODE === MODES.DRAG },
|
||||
},
|
||||
probe: {
|
||||
live: "https://live.grid.space",
|
||||
|
|
@ -902,18 +903,10 @@ gapp.register("kiri.main", [], (root, exports) => {
|
|||
current.mode = mode;
|
||||
MODE = MODES[mode];
|
||||
DRIVER = kiri.driver[mode];
|
||||
// update mode drop-down
|
||||
if (false) {
|
||||
const modename = $('mode-name');
|
||||
const options = modename.options;
|
||||
const optlist = ["FDM","CAM","SLA","LASER"];
|
||||
options.selectedIndex = optlist.indexOf(mode);
|
||||
modename.onchange = (ev) => setMode(optlist[options.selectedIndex]);
|
||||
}
|
||||
// gcode edit area for any non-SLA mode
|
||||
api.uc.setVisible($('gcode-edit'), mode !== 'SLA');
|
||||
// highlight selected mode menu item
|
||||
["FDM","CAM","SLA","LASER"].forEach(sm => {
|
||||
["FDM","CAM","SLA","LASER","DRAG"].forEach(sm => {
|
||||
const cl = $(`mode-${sm.toLowerCase()}`).classList;
|
||||
if (sm === mode) {
|
||||
cl.add('selected');
|
||||
|
|
|
|||
|
|
@ -340,7 +340,9 @@ gapp.register("kiri.ui", [], (root, exports) => {
|
|||
el.setVisible(hmod && show && xprt && disp);
|
||||
}
|
||||
el.hasMode = function(mode) {
|
||||
return el.modes.length === 0 || el.modes.contains(mode);
|
||||
return (el.modes.length === 0) ||
|
||||
(el.modes.contains && el.modes.contains(mode)) ||
|
||||
(el.modes === mode);
|
||||
}
|
||||
el.modes = opt.modes || [];
|
||||
hasModes.push(el);
|
||||
|
|
|
|||
|
|
@ -164,18 +164,18 @@
|
|||
<label>Laser</label>
|
||||
<span><i class="fas fa-bolt"></i></span>
|
||||
</div>
|
||||
<!-- <div id="mode-water">
|
||||
<!-- <div id="mode-wjet">
|
||||
<label>WaterJet</label>
|
||||
<span><i class="fas fa-location-pin"></i></span>
|
||||
</div>
|
||||
<div id="mode-edm">
|
||||
<div id="mode-wedm">
|
||||
<label>WireEDM</label>
|
||||
<span><i class="fas fa-ellipsis-vertical"></i></span>
|
||||
</div>
|
||||
<div id="mode-knife">
|
||||
<label>DragKnife</label>
|
||||
<span><i class="fas fa-caret-left"></i></span>
|
||||
</div> -->
|
||||
<div id="mode-drag">
|
||||
<label>Drag</label>
|
||||
<span><i class="fas fa-caret-left"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
|
|
|
|||
Loading…
Reference in a new issue