preserve op settings on last edit, compatible with 2.4
This commit is contained in:
parent
b29ffd3eec
commit
bcfba4e140
3 changed files with 99 additions and 101 deletions
1
notes.md
1
notes.md
|
|
@ -6,7 +6,6 @@
|
||||||
# - redo path planning
|
# - redo path planning
|
||||||
# - double-sided assistance
|
# - double-sided assistance
|
||||||
# - more tracing types (in, out, clear, pocket)
|
# - more tracing types (in, out, clear, pocket)
|
||||||
# - trace re-ordering
|
|
||||||
# `fdm`
|
# `fdm`
|
||||||
# - layer start point control
|
# - layer start point control
|
||||||
# - bind process to z ranges or boxed regions
|
# - bind process to z ranges or boxed regions
|
||||||
|
|
|
||||||
|
|
@ -148,18 +148,18 @@
|
||||||
case "outline":
|
case "outline":
|
||||||
func.opAddOutline();
|
func.opAddOutline();
|
||||||
break;
|
break;
|
||||||
case "contour x":
|
case "contour":
|
||||||
func.opAddContour('x');
|
let oplist = current.process.ops, axis = "X";
|
||||||
|
for (let op of oplist) {
|
||||||
|
if (op.type === "contour" && op.axis === "X") {
|
||||||
|
axis = "Y";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
func.opAddContour(axis);
|
||||||
break;
|
break;
|
||||||
case "contour y":
|
case "register":
|
||||||
func.opAddContour('y');
|
|
||||||
break;
|
|
||||||
case "register x":
|
|
||||||
func.opAddRegister('X', 2);
|
func.opAddRegister('X', 2);
|
||||||
break;
|
break;
|
||||||
case "register y":
|
|
||||||
func.opAddRegister('Y', 2);
|
|
||||||
break;
|
|
||||||
case "drill":
|
case "drill":
|
||||||
func.opAddDrill();
|
func.opAddDrill();
|
||||||
break;
|
break;
|
||||||
|
|
@ -170,94 +170,34 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
func.opAddRough = () => {
|
func.opAddRough = () => {
|
||||||
let process = API.conf.get().process;
|
func.opAdd(popOp.rough.new());
|
||||||
func.opAdd({
|
|
||||||
type: "rough",
|
|
||||||
tool: process.camRoughTool,
|
|
||||||
spindle: process.camRoughSpindle,
|
|
||||||
step: process.camRoughOver,
|
|
||||||
down: process.camRoughDown,
|
|
||||||
rate: process.camRoughSpeed,
|
|
||||||
plunge: process.camRoughPlunge,
|
|
||||||
leave: process.camRoughStock,
|
|
||||||
voids: process.camRoughVoid,
|
|
||||||
flats: process.camRoughFlat,
|
|
||||||
inside: process.camRoughIn,
|
|
||||||
top: process.camRoughTop
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
func.opAddOutline = () => {
|
func.opAddOutline = () => {
|
||||||
let process = API.conf.get().process;
|
func.opAdd(popOp.outline.new());
|
||||||
func.opAdd({
|
|
||||||
type: "outline",
|
|
||||||
tool: process.camOutlineTool,
|
|
||||||
spindle: process.camOutlineSpindle,
|
|
||||||
step: process.camOutlineOver,
|
|
||||||
down: process.camOutlineDown,
|
|
||||||
rate: process.camOutlineSpeed,
|
|
||||||
plunge: process.camOutlinePlunge,
|
|
||||||
dogbones: process.camOutlineDogbone,
|
|
||||||
outside: process.camOutlineOut,
|
|
||||||
inside: process.camOutlineIn,
|
|
||||||
wide: process.camOutlineWide
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
func.opAddContour = (axis) => {
|
func.opAddContour = (axis) => {
|
||||||
let process = API.conf.get().process;
|
let rec = popOp.contour.new();
|
||||||
func.opAdd({
|
rec.axis = axis.toUpperCase();
|
||||||
type: "contour",
|
func.opAdd(rec);
|
||||||
tool: process.camContourTool,
|
|
||||||
spindle: process.camContourSpindle,
|
|
||||||
step: process.camContourOver,
|
|
||||||
rate: process.camContourSpeed,
|
|
||||||
angle: process.camContourAngle,
|
|
||||||
tolerance: process.camTolerance,
|
|
||||||
curves: process.camContourCurves,
|
|
||||||
inside: process.camContourIn,
|
|
||||||
axis: axis.toUpperCase()
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
func.opAddTrace = () => {
|
func.opAddTrace = () => {
|
||||||
let process = API.conf.get().process;
|
let rec = popOp.trace.new();
|
||||||
func.opAdd({
|
rec.areas = { /* widget.id: [ polygons... ] */ };
|
||||||
type: "trace",
|
func.opAdd(rec);
|
||||||
mode: "follow",
|
|
||||||
tool: 1000,
|
|
||||||
rate: 1000,
|
|
||||||
plunge: 200,
|
|
||||||
areas: { /* widget.id: [ polygons... ] */ }
|
|
||||||
})
|
|
||||||
};
|
};
|
||||||
|
|
||||||
func.opAddDrill = () => {
|
func.opAddDrill = () => {
|
||||||
let process = API.conf.get().process;
|
func.opAdd(popOp.drill.new());
|
||||||
func.opAdd({
|
|
||||||
type: "drill",
|
|
||||||
tool: process.camDrillTool,
|
|
||||||
spindle: process.camDrillSpindle,
|
|
||||||
down: process.camDrillDown,
|
|
||||||
rate: process.camDrillDownSpeed,
|
|
||||||
dwell: process.camDrillDwell,
|
|
||||||
lift: process.camDrillLift
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
func.opAddRegister = (axis, points) => {
|
func.opAddRegister = (axis, points) => {
|
||||||
let process = API.conf.get().process;
|
let rec = popOp.register.new();
|
||||||
func.opAdd({
|
rec.axis = axis.toUpperCase();
|
||||||
type: "register",
|
rec.points = points;
|
||||||
tool: process.camDrillTool,
|
func.opAdd(rec);
|
||||||
spindle: process.camDrillSpindle,
|
|
||||||
down: process.camDrillDown,
|
|
||||||
rate: process.camDrillDownSpeed,
|
|
||||||
dwell: process.camDrillDwell,
|
|
||||||
lift: process.camDrillLift,
|
|
||||||
points: points,
|
|
||||||
axis: axis.toUpperCase()
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// TAB/TRACE BUTTON HANDLERS
|
// TAB/TRACE BUTTON HANDLERS
|
||||||
|
|
@ -300,10 +240,10 @@
|
||||||
|
|
||||||
api.event.on("cam.op.render", func.opRender = () => {
|
api.event.on("cam.op.render", func.opRender = () => {
|
||||||
$('camops').style.display = isCamMode && isArrange ? 'flex' : '';
|
$('camops').style.display = isCamMode && isArrange ? 'flex' : '';
|
||||||
if (!isCamMode) return;
|
let oplist = current.process.ops;
|
||||||
|
if (!(isCamMode && oplist)) return;
|
||||||
let mark = Date.now();
|
let mark = Date.now();
|
||||||
let html = [];
|
let html = [];
|
||||||
let oplist = current.process.ops;
|
|
||||||
$('ophint').style.display = oplist.length === 0 ? 'flex' : 'none';
|
$('ophint').style.display = oplist.length === 0 ? 'flex' : 'none';
|
||||||
let bind = {};
|
let bind = {};
|
||||||
let scale = API.view.unit_scale();
|
let scale = API.view.unit_scale();
|
||||||
|
|
@ -324,11 +264,7 @@
|
||||||
$(`${id}-x`).onmousedown = (ev) => {
|
$(`${id}-x`).onmousedown = (ev) => {
|
||||||
ev.stopPropagation();
|
ev.stopPropagation();
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
};
|
func.opDel(rec);
|
||||||
$(`${id}-x`).onclick = (ev) => {
|
|
||||||
oplist.splice(oplist.indexOf(rec), 1);
|
|
||||||
API.conf.save();
|
|
||||||
func.opRender();
|
|
||||||
};
|
};
|
||||||
let el = $(id);
|
let el = $(id);
|
||||||
bounds.push(el);
|
bounds.push(el);
|
||||||
|
|
@ -700,7 +636,19 @@
|
||||||
return current.device.spindleMax > 0;
|
return current.device.spindleMax > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
createPopOp('rough').inputs = {
|
createPopOp('rough', {
|
||||||
|
tool: 'camRoughTool',
|
||||||
|
spindle: 'camRoughSpindle',
|
||||||
|
down: 'camRoughDown',
|
||||||
|
step: 'camRoughOver',
|
||||||
|
rate: 'camRoughSpeed',
|
||||||
|
plunge: 'camRoughPlunge',
|
||||||
|
leave: 'camRoughStock',
|
||||||
|
voids: 'camRoughVoid',
|
||||||
|
flats: 'camRoughFlat',
|
||||||
|
inside: 'camRoughIn',
|
||||||
|
top: 'camRoughTop'
|
||||||
|
}).inputs = {
|
||||||
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||||
sep: UC.newBlank({class:"pop-sep"}),
|
sep: UC.newBlank({class:"pop-sep"}),
|
||||||
spindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, show:hasSpindle}),
|
spindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, show:hasSpindle}),
|
||||||
|
|
@ -716,7 +664,18 @@
|
||||||
inside: UC.newBoolean(LANG.cr_olin_s, undefined, {title:LANG.cr_olin_l})
|
inside: UC.newBoolean(LANG.cr_olin_s, undefined, {title:LANG.cr_olin_l})
|
||||||
};
|
};
|
||||||
|
|
||||||
createPopOp('outline').inputs = {
|
createPopOp('outline', {
|
||||||
|
tool: 'camOutlineTool',
|
||||||
|
spindle: 'camOutlineSpindle',
|
||||||
|
step: 'camOutlineOver',
|
||||||
|
down: 'camOutlineDown',
|
||||||
|
rate: 'camOutlineSpeed',
|
||||||
|
plunge: 'camOutlinePlunge',
|
||||||
|
dogbones: 'camOutlineDogbone',
|
||||||
|
outside: 'camOutlineOut',
|
||||||
|
inside: 'camOutlineIn',
|
||||||
|
wide: 'camOutlineWide'
|
||||||
|
}).inputs = {
|
||||||
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||||
sep: UC.newBlank({class:"pop-sep"}),
|
sep: UC.newBlank({class:"pop-sep"}),
|
||||||
spindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, show:hasSpindle}),
|
spindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, show:hasSpindle}),
|
||||||
|
|
@ -731,7 +690,17 @@
|
||||||
wide: UC.newBoolean(LANG.co_wide_s, undefined, {title:LANG.co_wide_l, show:(op) => { return !op.inputs.inside.checked }})
|
wide: UC.newBoolean(LANG.co_wide_s, undefined, {title:LANG.co_wide_l, show:(op) => { return !op.inputs.inside.checked }})
|
||||||
};
|
};
|
||||||
|
|
||||||
createPopOp('contour').inputs = {
|
createPopOp('contour', {
|
||||||
|
tool: 'camContourTool',
|
||||||
|
spindle: 'camContourSpindle',
|
||||||
|
step: 'camContourOver',
|
||||||
|
rate: 'camContourSpeed',
|
||||||
|
angle: 'camContourAngle',
|
||||||
|
tolerance: 'camTolerance',
|
||||||
|
curves: 'camContourCurves',
|
||||||
|
inside: 'camContourIn',
|
||||||
|
axis: 'X'
|
||||||
|
}).inputs = {
|
||||||
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||||
axis: UC.newSelect(LANG.cd_axis, {}, "regaxis"),
|
axis: UC.newSelect(LANG.cd_axis, {}, "regaxis"),
|
||||||
sep: UC.newBlank({class:"pop-sep"}),
|
sep: UC.newBlank({class:"pop-sep"}),
|
||||||
|
|
@ -745,7 +714,12 @@
|
||||||
inside: UC.newBoolean(LANG.cf_olin_s, undefined, {title:LANG.cf_olin_l})
|
inside: UC.newBoolean(LANG.cf_olin_s, undefined, {title:LANG.cf_olin_l})
|
||||||
};
|
};
|
||||||
|
|
||||||
createPopOp('trace').inputs = {
|
createPopOp('trace', {
|
||||||
|
mode: 'camTraceType',
|
||||||
|
tool: 'camTraceTool',
|
||||||
|
rate: 'camTraceSpeed',
|
||||||
|
plunge: 'camTracePlunge'
|
||||||
|
}).inputs = {
|
||||||
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||||
sep: UC.newBlank({class:"pop-sep"}),
|
sep: UC.newBlank({class:"pop-sep"}),
|
||||||
mode: UC.newSelect(LANG.cu_type_s, {title:LANG.cu_type_l}, "trace"),
|
mode: UC.newSelect(LANG.cu_type_s, {title:LANG.cu_type_l}, "trace"),
|
||||||
|
|
@ -758,7 +732,14 @@
|
||||||
], {class:"ext-buttons f-row"}),
|
], {class:"ext-buttons f-row"}),
|
||||||
};
|
};
|
||||||
|
|
||||||
createPopOp('drill').inputs = {
|
createPopOp('drill', {
|
||||||
|
tool: 'camDrillTool',
|
||||||
|
spindle: 'camDrillSpindle',
|
||||||
|
down: 'camDrillDown',
|
||||||
|
rate: 'camDrillDownSpeed',
|
||||||
|
dwell: 'camDrillDwell',
|
||||||
|
lift: 'camDrillLift'
|
||||||
|
}).inputs = {
|
||||||
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||||
sep: UC.newBlank({class:"pop-sep"}),
|
sep: UC.newBlank({class:"pop-sep"}),
|
||||||
spindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, show:hasSpindle}),
|
spindle: UC.newInput(LANG.cc_spnd_s, {title:LANG.cc_spnd_l, convert:UC.toInt, show:hasSpindle}),
|
||||||
|
|
@ -768,7 +749,14 @@
|
||||||
lift: UC.newInput(LANG.cd_lift_s, {title:LANG.cd_lift_l, convert:UC.toFloat, units:true})
|
lift: UC.newInput(LANG.cd_lift_s, {title:LANG.cd_lift_l, convert:UC.toFloat, units:true})
|
||||||
};
|
};
|
||||||
|
|
||||||
createPopOp('register').inputs = {
|
createPopOp('register', {
|
||||||
|
tool: 'camDrillTool',
|
||||||
|
spindle: 'camDrillSpindle',
|
||||||
|
down: 'camDrillDown',
|
||||||
|
rate: 'camDrillDownSpeed',
|
||||||
|
dwell: 'camDrillDwell',
|
||||||
|
lift: 'camDrillLift',
|
||||||
|
}).inputs = {
|
||||||
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
tool: UC.newSelect(LANG.cc_tool, {}, "tools"),
|
||||||
axis: UC.newSelect(LANG.cd_axis, {}, "regaxis"),
|
axis: UC.newSelect(LANG.cd_axis, {}, "regaxis"),
|
||||||
points: UC.newSelect(LANG.cd_points, {}, "regpoints"),
|
points: UC.newSelect(LANG.cd_points, {}, "regpoints"),
|
||||||
|
|
@ -781,7 +769,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
function createPopOp(type) {
|
function createPopOp(type, map) {
|
||||||
let op = popOp[type] = {
|
let op = popOp[type] = {
|
||||||
div: UC.newElement('div', { id:`${type}-op`, class:"cam-pop-op" }),
|
div: UC.newElement('div', { id:`${type}-op`, class:"cam-pop-op" }),
|
||||||
use: (rec) => {
|
use: (rec) => {
|
||||||
|
|
@ -794,9 +782,22 @@
|
||||||
},
|
},
|
||||||
bind: (ev) => {
|
bind: (ev) => {
|
||||||
API.util.ui2rec(op.rec, op.inputs);
|
API.util.ui2rec(op.rec, op.inputs);
|
||||||
|
for (let [key, val] of Object.entries(op.rec)) {
|
||||||
|
let saveTo = map[key];
|
||||||
|
if (saveTo) {
|
||||||
|
current.process[saveTo] = val;
|
||||||
|
}
|
||||||
|
}
|
||||||
API.conf.save();
|
API.conf.save();
|
||||||
op.hideshow();
|
op.hideshow();
|
||||||
},
|
},
|
||||||
|
new: () => {
|
||||||
|
let rec = { type };
|
||||||
|
for (let [key, val] of Object.entries(map)) {
|
||||||
|
rec[key] = current.process[val];
|
||||||
|
}
|
||||||
|
return rec;
|
||||||
|
},
|
||||||
hideshow: () => {
|
hideshow: () => {
|
||||||
for (let inp of Object.values(op.inputs)) {
|
for (let inp of Object.values(op.inputs)) {
|
||||||
let parent = inp.parentElement;
|
let parent = inp.parentElement;
|
||||||
|
|
|
||||||
|
|
@ -420,12 +420,10 @@
|
||||||
<div id="op-add-list" class="opdiv">
|
<div id="op-add-list" class="opdiv">
|
||||||
<div>rough</div>
|
<div>rough</div>
|
||||||
<div>outline</div>
|
<div>outline</div>
|
||||||
|
<div>contour</div>
|
||||||
|
<div>register</div>
|
||||||
<div>trace</div>
|
<div>trace</div>
|
||||||
<div>drill</div>
|
<div>drill</div>
|
||||||
<div>contour x</div>
|
|
||||||
<div>contour y</div>
|
|
||||||
<div>register x</div>
|
|
||||||
<div>register y</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue