fix brim offset bug. disable manual supports when automatic enabled

This commit is contained in:
Stewart Allen 2021-03-12 13:19:57 -05:00
commit ae9cd843c1
4 changed files with 37 additions and 8 deletions

View file

@ -198,7 +198,7 @@
// } // }
API.conf.update(); API.conf.update();
DOC.activeElement.blur(); DOC.activeElement.blur();
// API.event.emit("boolean.click"); API.event.emit("boolean.click");
} }
function onButtonClick(ev) { function onButtonClick(ev) {
@ -1691,7 +1691,7 @@
sliceSupportGen: UC.newRow([ sliceSupportGen: UC.newRow([
UI.ssaGen = UC.newButton(LANG.sp_detect, onButtonClick, {class: "f-col grow a-center"}) UI.ssaGen = UC.newButton(LANG.sp_detect, onButtonClick, {class: "f-col grow a-center"})
], { modes: FDM, class: "ext-buttons f-row grow", xshow:isNotBelt }), ], { modes: FDM, class: "ext-buttons f-row grow" }),
fdmSep: UC.newBlank({class:"pop-sep", modes:FDM, show:isNotBelt}), fdmSep: UC.newBlank({class:"pop-sep", modes:FDM, show:isNotBelt}),
sliceSupportManual: UC.newRow([ sliceSupportManual: UC.newRow([
(UI.ssmAdd = UC.newButton(undefined, onButtonClick, {icon:'<i class="fas fa-plus"></i>'})), (UI.ssmAdd = UC.newButton(undefined, onButtonClick, {icon:'<i class="fas fa-plus"></i>'})),

View file

@ -564,7 +564,9 @@
} }
function intersectsTop(p1, p2) { function intersectsTop(p1, p2) {
return retractRequired(p1, p2); if (opt.danger) {
return retractRequired(p1, p2);
}
let int = false; let int = false;
POLY.flatten(slice.topPolys().clone(true)).forEach(function(poly) { POLY.flatten(slice.topPolys().clone(true)).forEach(function(poly) {
if (!int) poly.forEachSegment(function(s1, s2) { if (!int) poly.forEachSegment(function(s1, s2) {

View file

@ -102,6 +102,23 @@
} }
} }
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) => { api.event.on("function.animate", (mode) => {
if (!isFdmMode) { if (!isFdmMode) {
return; return;
@ -160,6 +177,7 @@
}); });
api.event.on("settings.saved", (settings) => { api.event.on("settings.saved", (settings) => {
updateRanges(settings.process.ranges); updateRanges(settings.process.ranges);
func.updateSupportButtons();
// let ranges = settings.process.ranges; // let ranges = settings.process.ranges;
// UI.rangeGroup.style.display = isFdmMode && ranges && ranges.length ? 'flex' : 'none'; // UI.rangeGroup.style.display = isFdmMode && ranges && ranges.length ? 'flex' : 'none';
}); });
@ -217,8 +235,9 @@
}); });
api.event.on("fdm.supports.clear", func.sclear = () => { api.event.on("fdm.supports.clear", func.sclear = () => {
func.sdone(); func.sdone();
clearAllWidgetSupports(); if (clearAllWidgetSupports()) {
API.conf.save(); API.conf.save();
}
}); });
api.event.on("slice.begin", () => { api.event.on("slice.begin", () => {
if (!isFdmMode) { if (!isFdmMode) {
@ -495,18 +514,23 @@
} }
function clearAllWidgetSupports() { function clearAllWidgetSupports() {
let cleared = 0;
API.widgets.all().forEach(widget => { API.widgets.all().forEach(widget => {
clearWidgetSupports(widget); cleared += clearWidgetSupports(widget);
}); });
return cleared;
} }
function clearWidgetSupports(widget) { function clearWidgetSupports(widget) {
let cleared = 0;
Object.values(widget.sups || {}).forEach(support => { Object.values(widget.sups || {}).forEach(support => {
widget.adds.remove(support.box); widget.adds.remove(support.box);
widget.mesh.remove(support.box); widget.mesh.remove(support.box);
cleared++;
}); });
widget.sups = {}; widget.sups = {};
delete API.widgets.annotate(widget.id).support; delete API.widgets.annotate(widget.id).support;
return cleared;
} }
function delbox(name) { function delbox(name) {

View file

@ -32,6 +32,7 @@
isBelt = device.bedBelt, isBelt = device.bedBelt,
isThin = controller.lineType === "line", isThin = controller.lineType === "line",
isFlat = controller.lineType === "flat", isFlat = controller.lineType === "flat",
isDanger = controller.danger || false,
firstLayerHeight = isBelt ? process.sliceHeight : process.firstSliceHeight || process.sliceHeight, firstLayerHeight = isBelt ? process.sliceHeight : process.firstSliceHeight || process.sliceHeight,
firstLayerSeek = process.outputSeekrate, firstLayerSeek = process.outputSeekrate,
firstLayerRate = process.firstLayerRate, firstLayerRate = process.firstLayerRate,
@ -84,7 +85,8 @@
}); });
// nest and offset tops // nest and offset tops
POLY.nest(tops).forEach(function(poly) { POLY.nest(tops).forEach(function(poly) {
poly.offset(-offset + nozzle / 2).forEach(function(brim) { let off = poly.offset(-offset + nozzle / 2);
if (off) off.forEach(function(brim) {
brim.move(widget.track.pos); brim.move(widget.track.pos);
brims.push(brim); brims.push(brim);
}); });
@ -92,7 +94,7 @@
}); });
// merge brims // merge brims
brims = POLY.union(brims); brims = POLY.union(brims, undefined, true);
// if brim is offset, over-expand then shrink to induce brims to merge // if brim is offset, over-expand then shrink to induce brims to merge
if (offset && brims.length) { if (offset && brims.length) {
@ -412,6 +414,7 @@
layerout, layerout,
{ {
seedPoint: printPoint.sub(offset), seedPoint: printPoint.sub(offset),
danger: isDanger,
params, // range parameters params, // range parameters
first: slice.index === 0, first: slice.index === 0,
support: slice.widget.support, support: slice.widget.support,