add process origin offsets

This commit is contained in:
Stewart Allen 2023-01-06 22:25:37 -05:00
commit b657f66770
5 changed files with 37 additions and 11 deletions

View file

@ -70,7 +70,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
slices = widget.slices,
hasStock = stock.x && stock.y && stock.z && process.camStockOn,
isIndexed = hasStock && process.camStockIndexed,
startCenter = process.outputOriginCenter,
startCenter = process.camOriginCenter,
alignTop = settings.controller.alignTop,
zclear = (process.camZClearance || 1),
zmax_force = process.camForceZMax || false,
@ -80,12 +80,12 @@ function prepEach(widget, settings, print, firstPoint, update) {
bounds = widget.getBoundingBox(),
boundsz = bounds.max.z + ztOff,
zadd = hasStock && !isIndexed ? stock.z - boundsz : alignTop ? outerz - boundsz : 0,
zmax = outerz + zclear,
zmax = outerz + zclear + process.camOriginOffZ,
wmpos = widget.track.pos,
wmx = wmpos.x,
wmy = wmpos.y,
originx = startCenter ? 0 : hasStock ? -stock.x / 2 : bounds.min.x,
originy = startCenter ? 0 : hasStock ? -stock.y / 2 : bounds.min.y,
originx = (startCenter ? 0 : hasStock ? -stock.x / 2 : bounds.min.x) + process.camOriginOffX,
originy = (startCenter ? 0 : hasStock ? -stock.y / 2 : bounds.min.y) + process.camOriginOffY,
origin = newPoint(originx + wmx, originy + wmy, zmax),
output = print.output,
easeDown = process.camEaseDown,

View file

@ -572,7 +572,10 @@ const conf = exports({
camIndexAbs: true,
camStockOn: true,
camConventional: false, // outputClockwise
outputOriginCenter: false,
camOriginCenter: false,
camOriginOffX: 0,
camOriginOffY: 0,
camOriginOffZ: 0,
outputInvertX: false,
outputInvertY: false,
camExpertFast: false,

View file

@ -585,7 +585,8 @@ gapp.register("kiri.init", [], (root, exports) => {
return;
}
let current = settings(),
center = current.process.outputOriginCenter || current.device.bedRound,
{ device, process} = current,
center = process.outputOriginCenter || process.camOriginCenter || device.bedRound,
bounds = boundsSelection(),
coord = prompt("Enter X,Y coordinates for selection").split(','),
x = parseFloat(coord[0] || 0.0),
@ -593,8 +594,8 @@ gapp.register("kiri.init", [], (root, exports) => {
z = parseFloat(coord[2] || 0.0);
if (!center) {
x = x - current.device.bedWidth/2 + (bounds.max.x - bounds.min.x)/2;
y = y - current.device.bedDepth/2 + (bounds.max.y - bounds.min.y)/2
x = x - device.bedWidth/2 + (bounds.max.x - bounds.min.x)/2;
y = y - device.bedDepth/2 + (bounds.max.y - bounds.min.y)/2
}
api.selection.move(x, y, z, true);
@ -1977,10 +1978,17 @@ gapp.register("kiri.init", [], (root, exports) => {
camConventional: uc.newBoolean(LANG.ou_conv_s, onBooleanClick, {title:LANG.ou_conv_l, modes:CAM}),
camEaseDown: uc.newBoolean(LANG.cr_ease_s, onBooleanClick, {title:LANG.cr_ease_l, modes:CAM}),
camDepthFirst: uc.newBoolean(LANG.ou_depf_s, onBooleanClick, {title:LANG.ou_depf_l, modes:CAM}),
outputOriginBounds: uc.newBoolean(LANG.or_bnds_s, onBooleanClick, {title:LANG.or_bnds_l, modes:LASER}),
outputOriginCenter: uc.newBoolean(LANG.or_cntr_s, onBooleanClick, {title:LANG.or_cntr_l, modes:CAM_LZR}),
camOriginTop: uc.newBoolean(LANG.or_topp_s, onBooleanClick, {title:LANG.or_topp_l, modes:CAM}),
camForceZMax: uc.newBoolean(LANG.ou_forz_s, onBooleanClick, {title:LANG.ou_forz_l, modes:CAM}),
outputOriginBounds: uc.newBoolean(LANG.or_bnds_s, onBooleanClick, {title:LANG.or_bnds_l, modes:LASER}),
outputOriginCenter: uc.newBoolean(LANG.or_cntr_s, onBooleanClick, {title:LANG.or_cntr_l, modes:LASER}),
camOrigin: uc.newGroup(LANG.co_menu, null, {modes:CAM, xgroup:"cam_origin"}),
camOriginTop: uc.newBoolean(LANG.or_topp_s, onBooleanClick, {title:LANG.or_topp_l, modes:CAM}),
camOriginCenter: uc.newBoolean(LANG.or_cntr_s, onBooleanClick, {title:LANG.or_cntr_l, modes:CAM}),
camSep: uc.newBlank({class:"pop-sep", modes:CAM}),
camOriginOffX: uc.newInput(LANG.co_offx_s, {title:LANG.co_offx_l, convert:uc.toInt, modes:CAM}),
camOriginOffY: uc.newInput(LANG.co_offy_s, {title:LANG.co_offy_l, convert:uc.toInt, modes:CAM}),
camOriginOffZ: uc.newInput(LANG.co_offz_s, {title:LANG.co_offz_l, convert:uc.toInt, modes:CAM}),
camExpert: uc.newGroup(LANG.op_xprt_s, null, {group: "cam_expert", modes:CAM, marker: false}),
camExpertFast: uc.newBoolean(LANG.cx_fast_s, onBooleanClick, {title:LANG.cx_fast_l, modes:CAM, show: () => !ui.camTrueShadow.checked }),

View file

@ -51,7 +51,7 @@ function platformUpdateOrigin(update_bounds = true) {
let origin = settings.origin = { x: 0, y: 0, z: 0 };
let center = MODE === MODES.FDM ? device.originCenter || device.bedRound :
MODE === MODES.SLA ? false :
MODE === MODES.CAM ? process.outputOriginCenter :
MODE === MODES.CAM ? process.camOriginCenter :
device.originCenter || process.outputOriginCenter;
if (MODE === MODES.CAM && process.camOriginTop) {
@ -79,6 +79,12 @@ function platformUpdateOrigin(update_bounds = true) {
origin.y = device.bedDepth / 2;
}
if (MODE === MODES.CAM) {
origin.x += process.camOriginOffX;
origin.y += process.camOriginOffY;
origin.z += process.camOriginOffZ;
}
if (isIndexed) {
origin.y = 0;
}

View file

@ -706,6 +706,15 @@ self.kiri.lang['en-us'] = {
or_topp_s: "origin top",
or_topp_l: "origin is references from the top of objects",
// CAM ORIGIN
co_menu: "origin",
co_offx_s: "offset x",
co_offx_l: ["offset origin along x axis","in workspace units"],
co_offy_s: "offset y",
co_offt_l: ["offset origin along y axis","in workspace units"],
co_offz_s: "offset z",
co_offz_l: ["offset origin along z axis","in workspace units"],
// FDM ADVANCED
ad_menu: "expert",
ad_rdst_s: "retract dist",