From bf372eefcff0d7575b461d8e36a695916a71d180 Mon Sep 17 00:00:00 2001 From: Stewart Allen Date: Thu, 7 Jan 2021 22:46:16 -0500 Subject: [PATCH] belt improvements --- src/kiri/init.js | 33 +++++++++++++++++---------------- src/mode/fdm/prepare.js | 5 +++-- src/mode/fdm/slice.js | 31 +++++++++++++++++++++---------- 3 files changed, 41 insertions(+), 28 deletions(-) diff --git a/src/kiri/init.js b/src/kiri/init.js index 5877a0b4..c508e553 100644 --- a/src/kiri/init.js +++ b/src/kiri/init.js @@ -186,9 +186,9 @@ function onBooleanClick() { // prevent hiding elements in device editor on clicks - if (!API.modal.visible()) { + // if (!API.modal.visible()) { UC.refresh(); - } + // } API.conf.update(); DOC.activeElement.blur(); // API.event.emit("boolean.click"); @@ -795,6 +795,7 @@ } API.conf.save(); + UC.refresh(); if (dev.imageURL) { if (dev.imageURL !== deviceURL) { @@ -1502,8 +1503,8 @@ maxHeight: UC.newInput(LANG.dv_bedh_s, {title:LANG.dv_bedh_l, convert:UC.toFloat, size:6, modes:FDM_SLA}), spindleMax: UC.newInput(LANG.dv_spmx_s, {title:LANG.dv_spmx_l, convert:UC.toInt, size: 6, modes:CAM}), deviceOrigin: UC.newBoolean(LANG.dv_orgc_s, onBooleanClick, {title:LANG.dv_orgc_l, modes:FDM_LASER_SLA}), - deviceRound: UC.newBoolean(LANG.dv_bedc_s, onBooleanClick, {title:LANG.dv_bedc_l, modes:FDM}), - deviceBelt: UC.newBoolean(LANG.dv_belt_s, onBooleanClick, {title:LANG.dv_belt_l, modes:FDM}), + deviceRound: UC.newBoolean(LANG.dv_bedc_s, onBooleanClick, {title:LANG.dv_bedc_l, modes:FDM, show:() => !UI.deviceBelt.checked}), + deviceBelt: UC.newBoolean(LANG.dv_belt_s, onBooleanClick, {title:LANG.dv_belt_l, modes:FDM, trigger:true}), extruder: UC.newGroup(LANG.dv_gr_ext, $('device2'), {group:"dext", inline:true, modes:FDM}), extFilament: UC.newInput(LANG.dv_fila_s, {title:LANG.dv_fila_l, convert:UC.toFloat, modes:FDM}), @@ -1587,20 +1588,20 @@ laserSliceSingle: UC.newBoolean(LANG.ls_sngl_s, onBooleanClick, {title:LANG.ls_sngl_l, modes:LASER}), firstLayer: UC.newGroup(LANG.fl_menu, null, {modes:FDM}), - firstSliceHeight: UC.newInput(LANG.fl_lahi_s, {title:LANG.fl_lahi_l, convert:UC.toFloat, modes:FDM}), - fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}), - firstLayerNozzleTemp:UC.newInput(LANG.fl_nozl_s, {title:LANG.fl_nozl_l, convert:UC.toInt, modes:FDM}), - firstLayerBedTemp: UC.newInput(LANG.fl_bedd_s, {title:LANG.fl_bedd_l, convert:UC.toInt, modes:FDM}), - fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}), + firstSliceHeight: UC.newInput(LANG.fl_lahi_s, {title:LANG.fl_lahi_l, convert:UC.toFloat, modes:FDM, show:() => !UI.deviceBelt.checked}), + fdmSep: UC.newBlank({class:"pop-sep", modes:FDM, show:() => !UI.deviceBelt.checked}), + firstLayerNozzleTemp:UC.newInput(LANG.fl_nozl_s, {title:LANG.fl_nozl_l, convert:UC.toInt, modes:FDM, show:() => !UI.deviceBelt.checked}), + firstLayerBedTemp: UC.newInput(LANG.fl_bedd_s, {title:LANG.fl_bedd_l, convert:UC.toInt, modes:FDM, show:() => !UI.deviceBelt.checked}), + fdmSep: UC.newBlank({class:"pop-sep", modes:FDM, show:() => !UI.deviceBelt.checked}), firstLayerRate: UC.newInput(LANG.fl_rate_s, {title:LANG.fl_rate_l, convert:UC.toFloat, modes:FDM}), - firstLayerFillRate: UC.newInput(LANG.fl_frat_s, {title:LANG.fl_frat_l, convert:UC.toFloat, modes:FDM}), + firstLayerFillRate: UC.newInput(LANG.fl_frat_s, {title:LANG.fl_frat_l, convert:UC.toFloat, modes:FDM, show:() => !UI.deviceBelt.checked}), firstLayerPrintMult: UC.newInput(LANG.fl_mult_s, {title:LANG.fl_mult_l, convert:UC.toFloat, modes:FDM}), - fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}), - outputBrimCount: UC.newInput(LANG.fl_skrt_s, {title:LANG.fl_skrt_l, convert:UC.toInt, modes:FDM}), - outputBrimOffset: UC.newInput(LANG.fl_skro_s, {title:LANG.fl_skro_l, convert:UC.toFloat, modes:FDM}), - fdmSep: UC.newBlank({class:"pop-sep", modes:FDM}), - outputRaftSpacing: UC.newInput(LANG.fr_spac_s, {title:LANG.fr_spac_l, convert:UC.toFloat, bound:UC.bound(0.0,3.0), modes:FDM, show: () => UI.outputRaft.checked }), - outputRaft: UC.newBoolean(LANG.fr_nabl_s, onBooleanClick, {title:LANG.fr_nabl_l, modes:FDM, trigger: true}), + fdmSep: UC.newBlank({class:"pop-sep", modes:FDM, show:() => !UI.deviceBelt.checked}), + outputBrimCount: UC.newInput(LANG.fl_skrt_s, {title:LANG.fl_skrt_l, convert:UC.toInt, modes:FDM, show:() => !UI.deviceBelt.checked}), + outputBrimOffset: UC.newInput(LANG.fl_skro_s, {title:LANG.fl_skro_l, convert:UC.toFloat, modes:FDM, show:() => !UI.deviceBelt.checked}), + fdmSep: UC.newBlank({class:"pop-sep", modes:FDM, show:() => !UI.deviceBelt.checked}), + outputRaftSpacing: UC.newInput(LANG.fr_spac_s, {title:LANG.fr_spac_l, convert:UC.toFloat, bound:UC.bound(0.0,3.0), modes:FDM, show: () => UI.outputRaft.checked && !UI.deviceBelt.checked }), + outputRaft: UC.newBoolean(LANG.fr_nabl_s, onBooleanClick, {title:LANG.fr_nabl_l, modes:FDM, trigger: true, show: () => !UI.deviceBelt.checked }), fdmInfill: UC.newGroup(LANG.fi_menu, $('settings'), {modes:FDM}), sliceFillType: UC.newSelect(LANG.fi_type, {modes:FDM}, "infill"), diff --git a/src/mode/fdm/prepare.js b/src/mode/fdm/prepare.js index 293ec8de..c051fa7a 100644 --- a/src/mode/fdm/prepare.js +++ b/src/mode/fdm/prepare.js @@ -44,7 +44,8 @@ sliceEntry, print = self.worker.print = KIRI.newPrint(settings, widgets), isThin = settings.controller.lineType === "line", - isFlat = settings.controller.lineType === "flat"; + isFlat = settings.controller.lineType === "flat", + isBelt = device.bedBelt; // compute bounds if missing if (!bounds) { @@ -63,7 +64,7 @@ // TODO pick a widget with a slice on the first layer and use that nozzle // create brim, skirt, raft if specificed in FDM mode (code shared by laser) - if (process.outputBrimCount || process.outputRaft) { + if (!isBelt && (process.outputBrimCount || process.outputRaft)) { let brims = [], offset = process.outputBrimOffset || (process.outputRaft ? 4 : 0); diff --git a/src/mode/fdm/slice.js b/src/mode/fdm/slice.js index a64a4e7c..7f717c91 100644 --- a/src/mode/fdm/slice.js +++ b/src/mode/fdm/slice.js @@ -74,7 +74,8 @@ fillSpacing = nozzleSize, fillOffset = nozzleSize * fillOffsetMult, sliceFillAngle = spro.sliceFillAngle, - view = widget.mesh && widget.mesh.newGroup ? widget.mesh.newGroup() : null; + view = widget.mesh && widget.mesh.newGroup ? widget.mesh.newGroup() : null, + isBelt = sdev.bedBelt; isFlat = settings.controller.lineType === "flat"; isThin = !isFlat && settings.controller.lineType === "line"; @@ -141,7 +142,7 @@ SLICER.sliceWidget(widget, { height: sliceHeight, minHeight: sliceMinHeight, - firstHeight: spro.firstSliceHeight, + firstHeight: isBelt ? 0 : spro.firstSliceHeight, // debug: true, // xray: 3, // view: view @@ -203,7 +204,7 @@ doShells(slice, spro.sliceShells, firstOffset, shellOffset, fillOffset, { vase: vaseMode, thin: spro.detectThinWalls, - belt0: sdev.bedBelt && slice.index === 0, + belt0: isBelt && slice.index === 0, widget: widget }); if (solid) { @@ -365,6 +366,8 @@ * @param {Obejct} options */ function doShells(slice, count, offset1, offsetN, fillOffset, opt = {}) { + let shellout = 0; + slice.tops.forEach(function(top) { let top_poly = [ top.poly ]; @@ -470,12 +473,20 @@ // for diffing top.last = last; - if (opt.belt0 && top.shells.length === 0) { - let bounds = opt.widget.bounds; - top.shells.push(BASE.newPolygon() - .setOpen() - .add(bounds.min.x - 5,0,slice.z) - .add(bounds.max.x + 5,0,slice.z)); + shellout += top.shells.length; + + // add anchor extrusion if missing on the first belt layer + if (opt.belt0 && top.shells.length === 0 && slice.up && slice.up.tops.length) { + for (let up of slice.up.tops) { + let bounds = up.poly.bounds, + midy = (bounds.miny + bounds.maxy) / 2; + if (top.poly.isInside(up.poly, 1)) { + top.shells.push(BASE.newPolygon() + .setOpen() + .add(bounds.minx,midy,slice.z) + .add(bounds.maxx,midy,slice.z)); + } + } } }); }; @@ -495,7 +506,7 @@ } slice.tops.forEach(function(top) { - const lines = fillArea(top.fill_off, angle, spacing, null); + let lines = fillArea(top.fill_off, angle, spacing, null); top.fill_lines.appendAll(lines); });