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

View file

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

View file

@ -585,7 +585,8 @@ gapp.register("kiri.init", [], (root, exports) => {
return; return;
} }
let current = settings(), let current = settings(),
center = current.process.outputOriginCenter || current.device.bedRound, { device, process} = current,
center = process.outputOriginCenter || process.camOriginCenter || device.bedRound,
bounds = boundsSelection(), bounds = boundsSelection(),
coord = prompt("Enter X,Y coordinates for selection").split(','), coord = prompt("Enter X,Y coordinates for selection").split(','),
x = parseFloat(coord[0] || 0.0), x = parseFloat(coord[0] || 0.0),
@ -593,8 +594,8 @@ gapp.register("kiri.init", [], (root, exports) => {
z = parseFloat(coord[2] || 0.0); z = parseFloat(coord[2] || 0.0);
if (!center) { if (!center) {
x = x - current.device.bedWidth/2 + (bounds.max.x - bounds.min.x)/2; x = x - device.bedWidth/2 + (bounds.max.x - bounds.min.x)/2;
y = y - current.device.bedDepth/2 + (bounds.max.y - bounds.min.y)/2 y = y - device.bedDepth/2 + (bounds.max.y - bounds.min.y)/2
} }
api.selection.move(x, y, z, true); 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}), 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}), 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}), 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}), 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}), 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 }), 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 origin = settings.origin = { x: 0, y: 0, z: 0 };
let center = MODE === MODES.FDM ? device.originCenter || device.bedRound : let center = MODE === MODES.FDM ? device.originCenter || device.bedRound :
MODE === MODES.SLA ? false : MODE === MODES.SLA ? false :
MODE === MODES.CAM ? process.outputOriginCenter : MODE === MODES.CAM ? process.camOriginCenter :
device.originCenter || process.outputOriginCenter; device.originCenter || process.outputOriginCenter;
if (MODE === MODES.CAM && process.camOriginTop) { if (MODE === MODES.CAM && process.camOriginTop) {
@ -79,6 +79,12 @@ function platformUpdateOrigin(update_bounds = true) {
origin.y = device.bedDepth / 2; origin.y = device.bedDepth / 2;
} }
if (MODE === MODES.CAM) {
origin.x += process.camOriginOffX;
origin.y += process.camOriginOffY;
origin.z += process.camOriginOffZ;
}
if (isIndexed) { if (isIndexed) {
origin.y = 0; origin.y = 0;
} }

View file

@ -706,6 +706,15 @@ self.kiri.lang['en-us'] = {
or_topp_s: "origin top", or_topp_s: "origin top",
or_topp_l: "origin is references from the top of objects", 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 // FDM ADVANCED
ad_menu: "expert", ad_menu: "expert",
ad_rdst_s: "retract dist", ad_rdst_s: "retract dist",