add flip operation for double-sided work
This commit is contained in:
parent
55fdabd906
commit
8627f54a98
8 changed files with 79 additions and 8 deletions
1
notes.md
1
notes.md
|
|
@ -5,7 +5,6 @@
|
|||
# - revisit ease down
|
||||
# - split gcode output
|
||||
# - redo path planning
|
||||
# - double-sided assistance
|
||||
# `fdm`
|
||||
# - bind process to z ranges or boxed regions
|
||||
|
||||
|
|
|
|||
|
|
@ -456,6 +456,8 @@
|
|||
camDrillDwell: 250,
|
||||
camDrillLift: 2,
|
||||
camDrillingOn: false,
|
||||
camFlipAxis: "X",
|
||||
camFlipOther: "",
|
||||
// camDrillReg: "none",
|
||||
camTabsWidth: 5,
|
||||
camTabsHeight: 5,
|
||||
|
|
@ -480,7 +482,8 @@
|
|||
outputOriginCenter: false,
|
||||
outputInvertX: false,
|
||||
outputInvertY: false,
|
||||
ops: []
|
||||
ops: [], // current ops
|
||||
op2: [] // flip ops
|
||||
}
|
||||
},
|
||||
laser: {
|
||||
|
|
|
|||
|
|
@ -1640,7 +1640,7 @@
|
|||
******************************************************************* */
|
||||
|
||||
// given a settings region, update values of matching bound UI fields
|
||||
function updateFieldsFromSettings(setrec, uirec = UI) {
|
||||
function updateFieldsFromSettings(setrec, uirec = UI, trace) {
|
||||
if (!setrec) {
|
||||
return console.trace("missing scope");
|
||||
}
|
||||
|
|
@ -1664,7 +1664,7 @@
|
|||
} else if (typ === 'select-one') {
|
||||
uie.innerHTML = '';
|
||||
let source = uie.parentNode.getAttribute('source'),
|
||||
list = settings[source] || lists[source],
|
||||
list = uie._source || settings[source] || lists[source],
|
||||
chosen = null;
|
||||
if (list) list.forEach(function(el, index) {
|
||||
let id = el.id || el.name;
|
||||
|
|
|
|||
|
|
@ -733,7 +733,11 @@
|
|||
|
||||
row.appendChild(newLabel(label));
|
||||
row.appendChild(ip);
|
||||
if (Array.isArray(source)) {
|
||||
ip._source = source;
|
||||
} else {
|
||||
row.setAttribute("source", source || "tools");
|
||||
}
|
||||
row.setAttribute("class", "var-row");
|
||||
row.style.display = hide ? 'none' : '';
|
||||
if (options) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@
|
|||
|
||||
let zaxis = { x: 0, y: 0, z: 1 },
|
||||
popOp = {},
|
||||
func = {};
|
||||
func = {},
|
||||
flipping;
|
||||
|
||||
CAM.restoreTabs = restoreTabs;
|
||||
|
||||
|
|
@ -156,6 +157,14 @@
|
|||
case "register": return func.opAddRegister('X', 2);
|
||||
case "drill": return func.opAddDrill();
|
||||
case "trace": return func.opAddTrace();
|
||||
case "flip":
|
||||
// only one flip op permitted
|
||||
for (let op of current.process.ops) {
|
||||
if (op.type === 'flip') {
|
||||
return;
|
||||
}
|
||||
}
|
||||
return func.opAddFlip();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -194,6 +203,10 @@
|
|||
func.opAdd(rec);
|
||||
};
|
||||
|
||||
func.opAddFlip = () => {
|
||||
func.opAdd(popOp.flip.new());
|
||||
};
|
||||
|
||||
// TAB/TRACE BUTTON HANDLERS
|
||||
api.event.on("button.click", target => {
|
||||
let process = API.conf.get().process;
|
||||
|
|
@ -345,6 +358,41 @@
|
|||
}
|
||||
});
|
||||
|
||||
func.opFlip = () => {
|
||||
let { process } = current;
|
||||
let { ops, op2 } = process;
|
||||
let add2 = op2.length === 0; // add flip singleton to b-side
|
||||
let axis = poppedRec.axis;
|
||||
flipping = true;
|
||||
switch (axis) {
|
||||
case 'X':
|
||||
API.selection.rotate(Math.PI, 0, 0);
|
||||
// API.widgets.all().forEach(widget => {
|
||||
// widget.rotate(Math.PI, 0, 0);
|
||||
// });
|
||||
break;
|
||||
case 'Y':
|
||||
API.selection.rotate(0, Math.PI, 0);
|
||||
// API.widgets.all().forEach(widget => {
|
||||
// widget.rotate(0, Math.PI, 0);
|
||||
// });
|
||||
break;
|
||||
}
|
||||
flipping = false;
|
||||
process.ops = op2;
|
||||
process.op2 = ops;
|
||||
for (let op of op2) {
|
||||
if (op.type === 'flip') {
|
||||
op.axis = poppedRec.axis;
|
||||
}
|
||||
}
|
||||
if (add2) {
|
||||
func.opAdd(poppedRec);
|
||||
} else {
|
||||
func.opRender();
|
||||
}
|
||||
};
|
||||
|
||||
// TAB FUNCS
|
||||
let showTab, lastTab, tab, iw, ic;
|
||||
api.event.on("cam.tabs.add", func.tabAdd = () => {
|
||||
|
|
@ -628,6 +676,9 @@
|
|||
func.traceDone();
|
||||
}
|
||||
unselectTraces(widget);
|
||||
if (flipping) {
|
||||
return;
|
||||
}
|
||||
if (x || y) {
|
||||
clearTabs(widget);
|
||||
} else {
|
||||
|
|
@ -817,6 +868,16 @@
|
|||
dwell: UC.newInput(LANG.cd_dwll_s, {title:LANG.cd_dwll_l, convert:UC.toFloat}),
|
||||
lift: UC.newInput(LANG.cd_lift_s, {title:LANG.cd_lift_l, convert:UC.toFloat, units:true})
|
||||
};
|
||||
|
||||
createPopOp('flip', {
|
||||
axis: 'camFlipAxis'
|
||||
}).inputs = {
|
||||
axis: UC.newSelect(LANG.cd_axis, {}, "regaxis"),
|
||||
sep: UC.newBlank({class:"pop-sep"}),
|
||||
action: UC.newRow([
|
||||
UC.newButton(LANG.cc_flip, func.opFlip)
|
||||
], {class:"ext-buttons f-row"})
|
||||
};
|
||||
};
|
||||
|
||||
function createPopOp(type, map) {
|
||||
|
|
|
|||
|
|
@ -967,7 +967,8 @@
|
|||
"contour": OpContour,
|
||||
"trace": OpTrace,
|
||||
"drill": OpDrill,
|
||||
"register": OpRegister
|
||||
"register": OpRegister,
|
||||
"flip": CamOp
|
||||
};
|
||||
|
||||
})();
|
||||
|
|
|
|||
|
|
@ -422,9 +422,11 @@
|
|||
<div title="remove an area of material inside a defined boundary sometimes called pocketing">rough</div>
|
||||
<div title="clean up after roughing or perform a part cutout">outline</div>
|
||||
<div title="2.5D tracing along X or Y axis used for complex part features">contour</div>
|
||||
<div title="drill registration holes along the X or Y axis for double-sided milling">register</div>
|
||||
<div title="follow selected features with a specified tool. often used for lettering and engraving">trace</div>
|
||||
<div title="drill any holes matching selected tool diameter">drill</div>
|
||||
<hr width="100%">
|
||||
<div title="drill registration holes along the X or Y axis for double-sided work">register</div>
|
||||
<div title="flip part and load profile for other side for double-sided work">flip</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -273,6 +273,7 @@ kiri.lang['en-us'] = {
|
|||
|
||||
// CNC COMMON
|
||||
cc_menu: "limits",
|
||||
cc_flip: "flip",
|
||||
cc_rapd_s: "xy feed",
|
||||
cc_rapd_l: "max xy moves feedrate\nin workspace units / minute",
|
||||
cc_rzpd_s: "z feed",
|
||||
|
|
|
|||
Loading…
Reference in a new issue