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

@ -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) => {
if (!isFdmMode) {
return;
@ -160,6 +177,7 @@
});
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';
});
@ -217,8 +235,9 @@
});
api.event.on("fdm.supports.clear", func.sclear = () => {
func.sdone();
clearAllWidgetSupports();
API.conf.save();
if (clearAllWidgetSupports()) {
API.conf.save();
}
});
api.event.on("slice.begin", () => {
if (!isFdmMode) {
@ -495,18 +514,23 @@
}
function clearAllWidgetSupports() {
let cleared = 0;
API.widgets.all().forEach(widget => {
clearWidgetSupports(widget);
cleared += clearWidgetSupports(widget);
});
return cleared;
}
function clearWidgetSupports(widget) {
let cleared = 0;
Object.values(widget.sups || {}).forEach(support => {
widget.adds.remove(support.box);
widget.mesh.remove(support.box);
cleared++;
});
widget.sups = {};
delete API.widgets.annotate(widget.id).support;
return cleared;
}
function delbox(name) {

View file

@ -32,6 +32,7 @@
isBelt = device.bedBelt,
isThin = controller.lineType === "line",
isFlat = controller.lineType === "flat",
isDanger = controller.danger || false,
firstLayerHeight = isBelt ? process.sliceHeight : process.firstSliceHeight || process.sliceHeight,
firstLayerSeek = process.outputSeekrate,
firstLayerRate = process.firstLayerRate,
@ -84,7 +85,8 @@
});
// nest and offset tops
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);
brims.push(brim);
});
@ -92,7 +94,7 @@
});
// 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 (offset && brims.length) {
@ -412,6 +414,7 @@
layerout,
{
seedPoint: printPoint.sub(offset),
danger: isDanger,
params, // range parameters
first: slice.index === 0,
support: slice.widget.support,