add slice angle param (not fully impl)

This commit is contained in:
Stewart Allen 2024-07-07 11:41:00 -04:00
commit 58c33da9e8
5 changed files with 21 additions and 6 deletions

View file

@ -492,6 +492,10 @@ FDM.slice = function(settings, widget, onupdate, ondone) {
// add lead in anchor when specified in belt mode (but not for synths)
if (isBelt && !isSynth) {
let mrad = Math.cos(Math.PI/4);
let arad = Math.cos((Math.PI/180) * process.sliceAngle);
let ymlt = arad / mrad;
console.log({ arad, ymlt });
// find adjusted zero point from slices
let smin = Infinity;
for (let slice of slices) {
@ -499,12 +503,16 @@ FDM.slice = function(settings, widget, onupdate, ondone) {
for (let poly of slice.topPolys()) {
let y = poly.bounds.maxy;
let z = slice.z;
let by = z - y;
// at 45 degrees, 1mm in Z is 1mm in Y
// find formula for other angles
let by = z - (y * ymlt);
if (by < miny) miny = by;
if (by < smin) smin = by;
}
slice.belt = { miny, touch: false };
console.log({ miny, z:slice.z });
}
console.log({ smin });
// mark slices with tops touching belt
// also find max width of first 5 layers
let start;

View file

@ -359,17 +359,18 @@ kiri.worker = {
let widget = group[0];
let proc = settings.process;
let track = widget.track;
let angle = proc.sliceAngle;
let xpos = track.pos.x;
let yoff = proc.beltAnchor || proc.firstLayerBeltLead || 0;
let ypos = settings.device.bedDepth / 2 + track.pos.y + miny + yoff;
let rotation = (Math.PI / 180) * 45;
let rotation = (Math.PI / 180) * angle;
for (let w of group) {
w.moveMesh(0, miny, 0);
}
// rotating the root of the group rotates all widgets in the group
widget.rotate(rotation, 0, 0, true, false);
widget.belt = {
angle: 45,
angle,
// used during prepare
xpos,
ypos,

View file

@ -299,6 +299,7 @@ const conf = exports({
// process defaults FDM:Process
p:{
processName: "default",
sliceAngle: 45,
sliceHeight: 0.25,
sliceShells: 3,
sliceShellOrder: "in-out",

View file

@ -1858,20 +1858,22 @@ gapp.register("kiri.init", [], (root, exports) => {
firstLayerFlatten: newInput(LANG.fl_flat_s, {title:LANG.fl_flat_l, convert:toFloat, show:isBelt}),
firstLayerRate: newInput(LANG.fl_rate_s, {title:LANG.fl_rate_l, convert:toFloat}),
firstLayerFillRate: newInput(LANG.fl_frat_s, {title:LANG.fl_frat_l, convert:toFloat, show:isNotBelt}),
separator: newBlank({ class:"set-sep", driven }),
separator: newBlank({ class:"set-sep", driven, show:isNotBelt }),
firstLayerLineMult: newInput(LANG.fl_sfac_s, {title:LANG.fl_sfac_l, convert:toFloat, bound:bound(0.5,2), show:isNotBelt}),
firstLayerPrintMult: newInput(LANG.fl_mult_s, {title:LANG.fl_mult_l, convert:toFloat}),
separator: newBlank({ class:"set-sep", driven, show:isBelt }),
firstLayerBrim: newInput(LANG.fl_brim_s, {title:LANG.fl_brim_l, convert:toInt, show:isBelt}),
firstLayerBrimIn: newInput(LANG.fl_brin_s, {title:LANG.fl_brin_l, convert:toInt, show:isBelt}),
firstLayerBrimTrig: newInput(LANG.fl_brmn_s, {title:LANG.fl_brmn_l, convert:toInt, show:isBelt}),
firstLayerBrimGap: newInput(LANG.fl_brgp_s, {title:LANG.fl_brgp_l, convert:toFloat, show:isBelt}),
separator: newBlank({ class:"set-sep", driven, show:isBelt }),
firstLayerBeltLead: newInput(LANG.fl_bled_s, {title:LANG.fl_bled_l, convert:toFloat, show:isBelt}),
firstLayerBeltBump: newInput(LANG.fl_blmp_s, {title:LANG.fl_blmp_l, convert:toFloat, bound:bound(0, 10), show:isBelt}),
separator: newBlank({ class:"set-sep", driven }),
separator: newBlank({ class:"set-sep", driven, show:isNotBelt }),
outputBrimCount: newInput(LANG.fl_skrt_s, {title:LANG.fl_skrt_l, convert:toInt, show:isNotBelt}),
outputBrimOffset: newInput(LANG.fl_skro_s, {title:LANG.fl_skro_l, convert:toFloat, show:isNotBelt}),
outputRaftSpacing: newInput(LANG.fr_spac_s, {title:LANG.fr_spac_l, convert:toFloat, bound:bound(0.0,3.0), show: () => ui.outputRaft.checked && isNotBelt() }),
separator: newBlank({ class:"set-sep", driven }),
separator: newBlank({ class:"set-sep", driven, show:isNotBelt }),
outputRaft: newBoolean(LANG.fr_nabl_s, onBooleanClick, {title:LANG.fr_nabl_l, trigger: true, show:() => isNotBelt()}),
outputDraftShield: newBoolean(LANG.fr_draf_s, onBooleanClick, {title:LANG.fr_draf_l, trigger: true, show:() => isNotBelt()}),
_____: newGroup(LANG.ou_menu, $('fdm-output'), { modes:FDM, driven, separator }),
@ -1894,6 +1896,7 @@ gapp.register("kiri.init", [], (root, exports) => {
outputBeltFirst: newBoolean(LANG.ad_lbir_s, onBooleanClick, {title:LANG.ad_lbir_l, show: isBelt}),
outputNozzle: newSelect(LANG.sp_nozl_s, {title:LANG.sp_nozl_l, show:isMultiHead}, "extruders"),
_____: newGroup(LANG.ad_menu, $('fdm-expert'), { modes:FDM, driven, separator }),
sliceAngle: newInput(LANG.sl_angl_s, {title:LANG.sl_angl_l, convert:toFloat, show:isBelt}),
outputRetractDwell: newInput(LANG.ad_rdwl_s, {title:LANG.ad_rdwl_l, convert:toInt}),
sliceSolidMinArea: newInput(LANG.ad_msol_s, {title:LANG.ad_msol_l, convert:toFloat}),
outputMinSpeed: newInput(LANG.ad_mins_s, {title:LANG.ad_mins_l, convert:toFloat, bound:bound(1,200)}),

View file

@ -327,6 +327,8 @@ self.kiri.lang['en-us'] = {
// FDM LAYERS
sl_menu: "paths",
sl_angl_s: "slice angle",
sl_angl_l: ["slice angle bias in degrees"],
sl_lahi_s: "layer height",
sl_lahi_l: ["height of each slice","layer in millimeters"],
ad_minl_s: "layer minimum",