add ease down angle setting in UI triggered when ease down enabled

This commit is contained in:
Stewart Allen 2024-07-20 23:04:55 -04:00
commit 5fac736ea9
5 changed files with 8 additions and 7 deletions

View file

@ -1141,9 +1141,9 @@ class Polygon {
* 1. Travel from fromPoint to closest point on polygon, to rampZ above that that point,
* 2. ease-down starts, following the polygonal path, decreasing Z at a fixed slope until target Z is hit,
* 3. then the rest of the path is completed and repeated at target Z until touchdown point is reached.
*
* 4. this function should probably move to CAM prepare since it's only called from there
*/
forEachPointEaseDown(fn, fromPoint) {
forEachPointEaseDown(fn, fromPoint, degrees = 45) {
let index = this.findClosestPointTo(fromPoint).index,
fromZ = fromPoint.z,
offset = 0,
@ -1156,10 +1156,6 @@ class Polygon {
next,
done;
// XXX: These should be UI configurable options.
// "Slope" of the ease-down path in degrees, or an approximation thereof.
const degrees = 1;
// Slope for computations.
const slope = Math.tan((degrees * Math.PI) / 180);
// Z height above polygon Z from which to start the ease-down.

View file

@ -88,6 +88,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
origin = newPoint(originx + wmx, originy + wmy, zmax),
output = print.output,
easeDown = process.camEaseDown,
easeAngle = process.camEaseAngle,
depthFirst = process.camDepthFirst,
engageFactor = process.camFullEngage,
tolerance = 0,
@ -581,7 +582,7 @@ function prepEach(widget, settings, print, firstPoint, update) {
if (easeDown && poly.isClosed()) {
last = poly.forEachPointEaseDown(function(point, offset) {
camOut(point.clone(), offset > 0, undefined, scale);
}, fromPoint);
}, fromPoint, easeAngle);
} else {
poly.forEachPoint(function(point, pidx, points, offset) {
last = point;

View file

@ -569,6 +569,7 @@ const conf = exports({
camTabsMidline: false,
camDepthFirst: false,
camEaseDown: false,
camEaseAngle: 10,
camOriginTop: true,
camZAnchor: "middle",
camZOffset: 0,

View file

@ -1957,6 +1957,7 @@ gapp.register("kiri.init", [], (root, exports) => {
camFirstZMax: newBoolean(LANG.ou_z1st_s, onBooleanClick, {title:LANG.ou_z1st_l}),
camForceZMax: newBoolean(LANG.ou_forz_s, onBooleanClick, {title:LANG.ou_forz_l}),
separator: newBlank({ class:"set-sep", driven }),
camEaseAngle: newInput(LANG.ou_eang_s, {title:LANG.ou_eang_l, convert:toFloat, bound:bound(0.1,85), show:() => ui.camEaseDown.checked}),
camFullEngage: newInput(LANG.ou_feng_s, {title:LANG.ou_feng_l, convert:toFloat, bound:bound(0.1,1.0)}),
_____: newGroup(LANG.co_menu, $('cam-origin'), { modes:CAM, driven, separator }),
camOriginTop: newBoolean(LANG.or_topp_s, onBooleanClick, {title:LANG.or_topp_l}),

View file

@ -738,6 +738,8 @@ self.kiri.lang['en-us'] = {
ou_z1st_l: "first move in the job will be to Z max (travel distance above stock)",
ou_feng_s: "engage factor",
ou_feng_l: "speed scale (0.1-1) when endmill is fully engaged on a new cut. stepped over cuts when the endmill is less than fully engaged run at a factor of 1 relative to output speed. typically this relates to roughing or any operation with step over.",
ou_eang_s: "ease angle",
ou_eang_l: "descent angle for ease down in degrees",
// CAM STOCK
cs_menu: "stock",