add CAM custom gcode operator
This commit is contained in:
parent
bc3e738a8d
commit
c67d641e43
10 changed files with 94 additions and 14 deletions
|
|
@ -169,6 +169,7 @@ CAM.init = function(kiri, api) {
|
|||
let settings = API.conf.get();
|
||||
let { process, device } = settings;
|
||||
switch (ev.target.innerText) {
|
||||
case "gcode": return func.opAddGCode();
|
||||
case "level": return func.opAddLevel();
|
||||
case "rough": return func.opAddRough();
|
||||
case "outline": return func.opAddOutline();
|
||||
|
|
@ -195,6 +196,10 @@ CAM.init = function(kiri, api) {
|
|||
}
|
||||
};
|
||||
|
||||
func.opAddGCode = () => {
|
||||
func.opAdd(popOp.gcode.new());
|
||||
};
|
||||
|
||||
func.opAddLevel = () => {
|
||||
func.opAdd(popOp.level.new());
|
||||
};
|
||||
|
|
@ -421,6 +426,25 @@ CAM.init = function(kiri, api) {
|
|||
}
|
||||
});
|
||||
|
||||
func.opGCode = () => {
|
||||
API.dialog.show('any');
|
||||
const { c_gcode } = h.bind(
|
||||
$('mod-any'), h.div({ id: "camop_dialog" }, [
|
||||
h.label('custom gcode operation'),
|
||||
h.textarea({ id: "c_gcode", rows: 15, cols: 50 }),
|
||||
h.button({ _: 'done', onclick: () => {
|
||||
API.dialog.hide();
|
||||
API.conf.save();
|
||||
} })
|
||||
])
|
||||
);
|
||||
c_gcode.value = poppedRec.gcode || '';
|
||||
c_gcode.onkeyup = (el) => {
|
||||
poppedRec.gcode = c_gcode.value;
|
||||
};
|
||||
c_gcode.focus();
|
||||
};
|
||||
|
||||
func.opFlip = () => {
|
||||
let widgets = API.widgets.all();
|
||||
let { process } = current;
|
||||
|
|
@ -932,6 +956,12 @@ CAM.init = function(kiri, api) {
|
|||
return current.device.spindleMax > 0;
|
||||
}
|
||||
|
||||
createPopOp('gcode', {
|
||||
gcode: 'camCustomGcode',
|
||||
}).inputs = {
|
||||
action: UC.newRow([ UC.newButton(LANG.edit, func.opGCode) ], {class:"ext-buttons f-row"})
|
||||
};
|
||||
|
||||
createPopOp('level', {
|
||||
tool: 'camLevelTool',
|
||||
spindle: 'camLevelSpindle',
|
||||
|
|
|
|||
Loading…
Reference in a new issue