auto-resize belt besd to fit large objects
This commit is contained in:
parent
e7e7188941
commit
56ffc24f7a
1 changed files with 31 additions and 15 deletions
|
|
@ -1351,9 +1351,35 @@
|
||||||
updateSelectedBounds();
|
updateSelectedBounds();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function fitDeviceToWidgets() {
|
||||||
|
let maxy = 0;
|
||||||
|
forAllWidgets(function(widget) {
|
||||||
|
let wb = widget.mesh.getBoundingBox().clone();
|
||||||
|
maxy = Math.max(maxy, wb.max.y - wb.min.y);
|
||||||
|
});
|
||||||
|
let dev = settings.device;
|
||||||
|
if (maxy > dev.bedDepth) {
|
||||||
|
dev.bedDepthSave = dev.bedDepth;
|
||||||
|
dev.bedDepth = maxy + 10;
|
||||||
|
SPACE.platform.setSize(
|
||||||
|
parseInt(dev.bedWidth),
|
||||||
|
parseInt(dev.bedDepth),
|
||||||
|
parseFloat(dev.bedHeight),
|
||||||
|
parseFloat(dev.maxHeight)
|
||||||
|
);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function updateSelectedBounds(widgets) {
|
function updateSelectedBounds(widgets) {
|
||||||
// update bounds on selection for drag limiting
|
// update bounds on selection for drag limiting
|
||||||
let isBelt = settings.device.bedBelt;
|
let isBelt = settings.device.bedBelt;
|
||||||
|
if (isBelt) {
|
||||||
|
if (fitDeviceToWidgets()) {
|
||||||
|
platform.update_origin();
|
||||||
|
SPACE.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
let dvy = settings.device.bedDepth;
|
let dvy = settings.device.bedDepth;
|
||||||
let dvx = settings.device.bedWidth;
|
let dvx = settings.device.bedWidth;
|
||||||
let bounds_sel = new THREE.Box3();
|
let bounds_sel = new THREE.Box3();
|
||||||
|
|
@ -1614,20 +1640,6 @@
|
||||||
wb.max.y += wp.y;
|
wb.max.y += wp.y;
|
||||||
bounds.union(wb);
|
bounds.union(wb);
|
||||||
});
|
});
|
||||||
if (settings.device.bedBelt) {
|
|
||||||
let dev = settings.device,
|
|
||||||
isBelt = dev.bedBelt,
|
|
||||||
maxy = bounds.max.y - bounds.min.y;
|
|
||||||
// if (maxy > dev.bedDepth) {
|
|
||||||
// console.log({maxy}, settings.device.bedDepth)
|
|
||||||
// SPACE.platform.setSize(
|
|
||||||
// parseInt(dev.bedWidth),
|
|
||||||
// parseInt(maxy),
|
|
||||||
// parseFloat(dev.bedHeight),
|
|
||||||
// parseFloat(dev.maxHeight)
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
return settings.bounds = bounds;
|
return settings.bounds = bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1889,6 +1901,10 @@
|
||||||
break;
|
break;
|
||||||
case MODES.FDM:
|
case MODES.FDM:
|
||||||
space = space || ((proc.sliceSupportExtra || 0) * 2) + 1;
|
space = space || ((proc.sliceSupportExtra || 0) * 2) + 1;
|
||||||
|
// auto resize device to support a larger object
|
||||||
|
if (isBelt) {
|
||||||
|
fitDeviceToWidgets();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1942,7 +1958,7 @@
|
||||||
let bounds = platformUpdateBounds(),
|
let bounds = platformUpdateBounds(),
|
||||||
movey = -(dev.bedDepth / 2 + bounds.min.y);
|
movey = -(dev.bedDepth / 2 + bounds.min.y);
|
||||||
forAllWidgets(widget => {
|
forAllWidgets(widget => {
|
||||||
// only move the master widget in the group
|
// only move the root widget in the group
|
||||||
if (widget.id === widget.group.id) {
|
if (widget.id === widget.group.id) {
|
||||||
widget.move(0, movey + 5, 0)
|
widget.move(0, movey + 5, 0)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue