diff --git a/release.md b/release.md index c5183ec9..bd194977 100644 --- a/release.md +++ b/release.md @@ -5,6 +5,7 @@ Full docs @ https://docs.grid.space/projects/kiri-moto # Release 3.6 +* allow FDM mixing of automatic and manual / detected supports * improve CAM animation speeds using shared array buffers * improve CAM render quality using solids instead of lines * add CAM leveling part offset parameters for XY and Z diff --git a/src/kiri-mode/fdm/client.js b/src/kiri-mode/fdm/client.js index 3c4fdb88..e229202c 100644 --- a/src/kiri-mode/fdm/client.js +++ b/src/kiri-mode/fdm/client.js @@ -130,23 +130,6 @@ FDM.init = function(kiri, api) { } } - api.event.on("boolean.click", func.updateSupportButtons = () => { - if (!isFdmMode) { - return; - } - for (let btn of [ - ui.ssaGen, - ui.ssmAdd, - ui.ssmDun, - ui.ssmClr - ]) { - btn.disabled = ui.sliceSupportEnable.checked; - } - if (ui.sliceSupportEnable.checked) { - func.sclear(); - } - }); - api.event.on("function.animate", (mode) => { if (!isFdmMode) { return; @@ -205,7 +188,6 @@ FDM.init = function(kiri, api) { }); api.event.on("settings.saved", (settings) => { updateRanges(settings.process.ranges); - func.updateSupportButtons(); // let ranges = settings.process.ranges; // ui.rangeGroup.style.display = isFdmMode && ranges && ranges.length ? 'flex' : 'none'; }); diff --git a/src/kiri-mode/fdm/prepare.js b/src/kiri-mode/fdm/prepare.js index 757556f0..f4a63580 100644 --- a/src/kiri-mode/fdm/prepare.js +++ b/src/kiri-mode/fdm/prepare.js @@ -35,7 +35,7 @@ FDM.prepare = function(widgets, settings, update) { widgets = widgets.filter(w => !w.track.ignore && !w.meta.disabled); let { device, process, controller, bounds, mode } = settings, - { sliceHeight, firstSliceHeight, firstLayerRate } = process, + { sliceHeight, firstSliceHeight, firstLayerRate, sliceSupportOutline } = process, { outputSeekrate, outputDraftShield, outputPurgeTower } = process, { bedWidth, bedDepth, filamentSource } = device, { lineType, danger } = controller, @@ -1358,7 +1358,9 @@ function slicePrintPath(print, slice, startPoint, offset, output, opt = {}) { print.setType('support'); // support polygon next.setZ(z); - outputTraces([next].appendAll(next.inner || [])); + if (sliceSupportOutline !== false) { + outputTraces([next].appendAll(next.inner || [])); + } if (next.fill) { next.fill.forEach(p => { p.z = z }); outputFills(next.fill, {fast: true}); diff --git a/src/kiri-mode/fdm/slice.js b/src/kiri-mode/fdm/slice.js index b13c9fd7..a1240dd1 100644 --- a/src/kiri-mode/fdm/slice.js +++ b/src/kiri-mode/fdm/slice.js @@ -127,7 +127,8 @@ FDM.slice = function(settings, widget, onupdate, ondone) { // allow overriding support fill auto angle algorithm // also causes support fill to be aligned on start boundaries // best with angles that are a multiple of 90 degrees - if (process.sliceSupportFill !== undefined) { + if (process.sliceSupportFill >= 0) { + // yes, an ugly hack to allow it to pass through old code paths process.sliceSupportFill += 1000; } @@ -414,8 +415,15 @@ FDM.slice = function(settings, widget, onupdate, ondone) { if (Math.abs(Math.abs(pslice.z - slice.z) - gap) > 0.1) { continue; } + let clipto = pslice.clips; + if (pslice.supportOutline) { + // merge support outlines into slice clips which + // should only happen when automatic and manual + // supports are used together + clipto.appendAll(pslice.supportOutline); + } let ntops = []; - POLY.subtract(tops, pslice.clips, ntops, null, slice.z, 0); + POLY.subtract(tops, clipto, ntops, null, slice.z, 0); tops = ntops; } // trim to group's shadow if not in belt mode @@ -724,22 +732,17 @@ FDM.slice = function(settings, widget, onupdate, ondone) { let density = params.sliceSupportDensity; if (density) for (let top of slice.tops) { + let offset = []; if (!outline) { - let offset = top.shells; - fillSupportPolys({ - promises, polys: offset, lineWidth, density, z: slice.z, isBelt, - angle: process.sliceSupportFill - }); - resolve.push({top, offset}); + POLY.expand(top.shells || [], lineWidth, slice.z, offset); } else { - let offset = []; POLY.expand(top.shells || [], -lineWidth/4, slice.z, offset); - fillSupportPolys({ - promises, polys: offset, lineWidth, density, z: slice.z, isBelt, - angle: process.sliceSupportFill - }); - resolve.push({top, offset}); } + fillSupportPolys({ + promises, polys: offset, lineWidth, density, z: slice.z, isBelt, + angle: process.sliceSupportFill + }); + resolve.push({top, offset}); } }, "infill"); if (promises) { @@ -748,35 +751,11 @@ FDM.slice = function(settings, widget, onupdate, ondone) { }); } for (let rec of resolve) { + let spacing = lineWidth * (1 / supportDensity); let lines = rec.top.fill_lines = rec.offset.map(o => o.fill).flat().filter(v => v); - // if copying simply's support type, eliminate shells - // and zig/zag lines connectd by shell segments + // if copying simply's support type, eliminate shells and zig/zag fill lines if (!outline) { - let newlines = []; - let op2; - let eo = 0; - let idx = 1; - for (let i=0; i 0) { doFillArea(promises, inset, angle || auto, spacing, poly.fill = []); + if (!outline && poly.fill.length) { + poly.fill = connect_lines(poly.fill, spacing * 2); + } } return true; }); diff --git a/src/kiri/init.js b/src/kiri/init.js index 7cc22e3c..d6d8801e 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -1862,10 +1862,10 @@ gapp.register("kiri.init", [], (root, exports) => { sliceSupportArea: uc.newInput(LANG.sp_area_s, {title:LANG.sp_area_l, bound:uc.bound(0.0,200.0), convert:uc.toFloat, modes:FDM}), sliceSupportExtra: uc.newInput(LANG.sp_xpnd_s, {title:LANG.sp_xpnd_l, bound:uc.bound(0.0,200.0), convert:uc.toFloat, modes:FDM}), fdmSep: uc.newBlank({class:"pop-sep", modes:FDM}), - sliceSupportAngle: uc.newInput(LANG.sp_angl_s, {title:LANG.sp_angl_l, bound:uc.bound(0.0,90.0), convert:uc.toFloat, modes:FDM, show:() => !ui.sliceSupportEnable.checked}), + sliceSupportAngle: uc.newInput(LANG.sp_angl_s, {title:LANG.sp_angl_l, bound:uc.bound(0.0,90.0), convert:uc.toFloat, modes:FDM}), sliceSupportSpan: uc.newInput(LANG.sp_span_s, {title:LANG.sp_span_l, bound:uc.bound(0.0,200.0), convert:uc.toFloat, modes:FDM, show:() => ui.sliceSupportEnable.checked}), sliceSupportEnable: uc.newBoolean(LANG.sp_auto_s, onBooleanClick, {title:LANG.sp_auto_l, modes:FDM, show:isNotBelt}), - sliceSupportOutline: uc.newBoolean(LANG.sp_outl_s, onBooleanClick, {title:LANG.sp_outl_l, modes:FDM, show:() => !ui.sliceSupportEnable.checked}), + sliceSupportOutline: uc.newBoolean(LANG.sp_outl_s, onBooleanClick, {title:LANG.sp_outl_l, modes:FDM}), sliceSupportGen: uc.newRow([ ui.ssaGen = uc.newButton(LANG.sp_detect, onButtonClick, {class: "f-col grow a-center"})