add CAM z bottom inversion option to flip operator

This commit is contained in:
Stewart Allen 2022-10-05 14:05:21 -04:00
commit 94dfc15768
4 changed files with 24 additions and 10 deletions

View file

@ -19,6 +19,7 @@ Full docs @ https://docs.grid.space/projects/kiri-moto
* add option to ignore z bottom in CAM contouring
* add CAM pocket option to ignore interior features (outline only)
* add CAM Z bottom visualization, make it relative to stock instead of part
* add CAM z bottom inversion option to flip operator
* extend url loading of workspaces to all formats
* alert when healing is enabled and non-manifold geometries are detected
* fix thin output start and end point tracking which broke retraction

View file

@ -473,14 +473,18 @@ CAM.init = function(kiri, api) {
flipping = false;
process.ops = op2;
process.op2 = ops;
// special case, auto-adjust camZBottom
if (process.camZBottom && widgets.length === 1) {
process.camZBottom = widgets[0].bounds.max.z - process.camZBottom;
// flip camZBottom
if (poppedRec.invert && process.camZBottom && camZBottom) {
const maxZ = camZBottom._max.z
process.camZBottom = maxZ - process.camZBottom;
API.util.rec2ui(process);
updateStock();
}
// keep flip operations in sync
for (let op of op2) {
if (op.type === 'flip') {
op.axis = poppedRec.axis;
op.invert = poppedRec.invert;
}
}
if (add2) {
@ -1128,12 +1132,15 @@ CAM.init = function(kiri, api) {
};
createPopOp('flip', {
axis: 'camFlipAxis'
axis: 'camFlipAxis',
invert: 'camFlipInvert'
}).inputs = {
axis: UC.newSelect(LANG.cd_axis, {}, "regaxis"),
sep: UC.newBlank({class:"pop-sep", show:(op,conf) => conf.process.camZBottom}),
invert: UC.newBoolean(LANG.cf_nvrt_s, undefined, {title:LANG.cf_nvrt_l, show:(op,conf) => conf.process.camZBottom}),
sep: UC.newBlank({class:"pop-sep"}),
action: UC.newRow([
UC.newButton(LANG.cc_flip, func.opFlip)
UC.newButton(LANG.cf_menu, func.opFlip)
], {class:"ext-buttons f-row"})
};
};
@ -1408,10 +1415,11 @@ function updateStock(args, event) {
SPACE.world.remove(camZBottom);
if (proc.camZBottom) {
let max = { x: csx, y: csy };
let max = { x: csx, y: csy, z: csz };
for (let w of widgets) {
max.x = Math.max(max.x, w.track.box.w);
max.y = Math.max(max.y, w.track.box.h);
max.z = Math.max(max.z, w.track.box.d);
}
let geo = new THREE.PlaneGeometry(max.x, max.y);
let mat = new THREE.MeshBasicMaterial({
@ -1423,6 +1431,7 @@ function updateStock(args, event) {
camZBottom = new THREE.Mesh(geo, mat);
camZBottom.renderOrder = 1;
camZBottom.position.z = proc.camZBottom;
camZBottom._max = max;
SPACE.world.add(camZBottom);
} else {
camZBottom = undefined;

View file

@ -532,12 +532,12 @@ gapp.register("kiri.main", [], (root, exports) => {
}
function loadFile() {
$('load-file').onchange = function(event) {
const button = $('load-file');
button.onchange = function(event) {
console.log(event);
api.platform.load_files(event.target.files);
};
$('load-file').click();
// api.show.alert("drag/drop STL files onto platform to import\nreload page to return to last saved state");
button.click();
}
function saveWorkspace(quiet) {

View file

@ -448,7 +448,6 @@ self.kiri.lang['en-us'] = {
// CNC COMMON
cc_menu: "limits",
cc_flip: "flip",
cc_rapd_s: "xy feed",
cc_rapd_l: ["max xy moves feedrate","in workspace units / minute"],
cc_rzpd_s: "z feed",
@ -530,6 +529,11 @@ self.kiri.lang['en-us'] = {
cd_mark_s: "marking",
cd_mark_l: ["only mark holes, do not drill out","the step down setting is used","to determine how deep to mark"],
// CNC FLIP
cf_menu: "flip",
cf_nvrt_s: "z bottom",
cf_nvrt_l: "invert z bottom setting to follow stock",
// CNC CUTOUT TABS
ct_menu: "tabs",
ct_angl_s: "angle",