add grid visibility controls for CAM indexed stock mode

This commit is contained in:
Stewart Allen 2022-11-05 18:51:37 -04:00
commit 29f50728c5
7 changed files with 30 additions and 15 deletions

View file

@ -88,7 +88,6 @@
* `F` add adaptive clearing strategy
* `F` add ease-down support to trace op
* `F` add climb/conventional into each operation
* `F` add lathe mode / A-axis / 4th axis / rotary milling ops
* `F` add support for tapered ball mills
* `F` change color of line selection in trace op when not a closed poly
* `F` limit cut depth to flute length of selected tool (or warn)

View file

@ -4,6 +4,7 @@ Full docs @ https://docs.grid.space/projects/kiri-moto
# Release 3.7
* add CAM 4th axis indexing support, timeline op, updated visuals
* align FDM top/bottom layer options with convention
* add Mesh:Tool SVG import options for extrusion depth and boolean repair
* replace jscad/modeling with Manifold project for faster mesh boolean

View file

@ -64,12 +64,8 @@ CAM.init = function(kiri, api) {
UC = api.uc;
API = api;
function zBottom() {
return API.conf.get().process.camZBottom > 0;
}
function setAnimationStyle(refresh) {
const { camStockIndexed, camStockOn } = current.process;
function updateAxisMode(refresh) {
const { camStockIndexGrid, camStockIndexed, camStockOn } = current.process;
let newIndexed = camStockIndexed && camStockOn;
let changed = refresh || isIndexed !== newIndexed;
isIndexed = newIndexed;
@ -86,6 +82,7 @@ CAM.init = function(kiri, api) {
}
animVer = isIndexed ? 1 : 0;
SPACE.platform.setVisible(!isIndexed);
SPACE.platform.showGrid2(!isIndexed || camStockIndexGrid);
$('cam-index').style.display = isIndexed ? '' : 'none';
if (!changed) {
return;
@ -112,7 +109,7 @@ CAM.init = function(kiri, api) {
api.event.on("widget.add", widget => {
if (isCamMode && !Array.isArray(widget)) {
setAnimationStyle(true);
updateAxisMode(true);
widget.setIndexed(camStock && isIndexed ? camStock.scale.z : 0);
api.platform.update_bounds();
}
@ -191,7 +188,7 @@ CAM.init = function(kiri, api) {
api.ui.camTabs.marker.style.display = hasTabs ? 'flex' : 'none';
api.ui.camStock.marker.style.display = proc.camStockOn ? 'flex' : 'none';
api.platform.update_bounds();
setAnimationStyle();
updateAxisMode();
updateStock();
func.opRender();
});
@ -201,7 +198,7 @@ CAM.init = function(kiri, api) {
if (!isCamMode) return;
validateTools(settings.tools);
restoreTabs(api.widgets.all());
setAnimationStyle();
updateAxisMode();
});
api.event.on("boolean.click", api.platform.update_bounds);
@ -1155,6 +1152,10 @@ CAM.init = function(kiri, api) {
return current.device.spindleMax > 0;
}
function zBottom() {
return API.conf.get().process.camZBottom > 0;
}
createPopOp('level', {
tool: 'camLevelTool',
spindle: 'camLevelSpindle',

View file

@ -566,6 +566,7 @@ const conf = exports({
camStockOffset: true,
camStockClipTo: false,
camStockIndexed: false,
camStockIndexGrid: false,
camIndexAxis: 0,
camIndexAbs: true,
camStockOn: true,

View file

@ -1918,6 +1918,7 @@ gapp.register("kiri.init", [], (root, exports) => {
camStockOffset: uc.newBoolean(LANG.cs_offs_s, onBooleanClick, {title:LANG.cs_offs_l, modes:CAM}),
camStockClipTo: uc.newBoolean(LANG.cs_clip_s, onBooleanClick, {title:LANG.cs_clip_l, modes:CAM}),
camSep: uc.newBlank({class:"pop-sep"}),
camStockIndexGrid: uc.newBoolean(LANG.cs_ishg_s, onBooleanClick, {title:LANG.cs_ishg_l, modes:CAM, show:() => ui.camStockOn.checked && ui.camStockIndexed.checked}),
camStockIndexed: uc.newBoolean(LANG.cs_indx_s, onBooleanClick, {title:LANG.cs_indx_l, modes:CAM, show:() => ui.camStockOn.checked}),
camStockOn: uc.newBoolean(LANG.cs_offe_s, onBooleanClick, {title:LANG.cs_offe_l, modes:CAM}),

View file

@ -42,6 +42,7 @@ gapp.register("moto.space", [], (root, exports) => {
showPlatform = true,
hidePlatformBelow = true,
hideGridBelow = false,
showGridLines = true,
showFocus = 0,
focalPoint = undefined,
lightInfo = {
@ -73,7 +74,9 @@ gapp.register("moto.space", [], (root, exports) => {
colorY: 0x6666ff,
zoff: 0,
opacity: 1,
view: undefined
view: undefined,
axes: undefined,
lines: undefined
},
ruler = {
x1: 0,
@ -556,8 +559,13 @@ gapp.register("moto.space", [], (root, exports) => {
function updateGrid() {
let { view, unitMinor, unitMajor, colorMajor, colorMinor, colorX, colorY } = grid;
let oldView = view;
let axes = grid.axes = new THREE.Group();
let lines = grid.lines = new THREE.Group();
view = grid.view = new THREE.Group();
view.visible = oldView ? oldView.visible : true;
view.add(lines);
view.add(axes);
let majors = [],
minors = [],
@ -601,19 +609,20 @@ gapp.register("moto.space", [], (root, exports) => {
let arr = modMatch(y, unitMajor) ? majors : minors;
arr.append({x:-ow, y:y-yo, z:zp}).append({x:ow, y:y-yo, z:zp});
}
view.add(makeLinesFromPoints(majors, colorMajor));
view.add(makeLinesFromPoints(minors, colorMinor));
view.add(makeLinesFromPoints([
lines.add(makeLinesFromPoints(majors, colorMajor));
lines.add(makeLinesFromPoints(minors, colorMinor));
axes.add(makeLinesFromPoints([
{x: -xo, y:y1-yo, z:zp},
{x: -xo, y:y2-yo, z:zp},
], colorY));
view.add(makeLinesFromPoints([
axes.add(makeLinesFromPoints([
{x: x1-xo, y:-yo, z:zp},
{x: x2-xo, y:-yo, z:zp},
], colorX));
Space.scene.remove(oldView);
Space.scene.add(grid.view);
lines.visible = showGridLines;
requestRefresh();
}
@ -1178,6 +1187,7 @@ gapp.register("moto.space", [], (root, exports) => {
showVolume,
showGridBelow: (b) => { hideGridBelow = !b },
showGrid: (b) => { grid.view.visible = b },
showGrid2: (b) => { showGridLines = grid.lines.visible = b },
setMaxZ: (z) => { panY = z / 2 },
setCenter: (x,y,z) => { panX = x; panY = z, panZ = y },
setHidden: (b) => { showPlatform = !b; platform.visible = !b },

View file

@ -689,6 +689,8 @@ self.kiri.lang['en-us'] = {
cs_offs_l: ["use width, depth, height","as offsets from max","part size on platform"],
cs_clip_s: "clip to",
cs_clip_l: ["rough and outline","clip cutting paths","to defined stock"],
cs_ishg_s: "show grid",
cs_ishg_l: ["show platform grid in indexed mode"],
cs_indx_s: "indexed",
cs_indx_l: ["stock is mounted to a rotatary indexer"],
cs_offe_s: "enable",