fix preview progress. scale slicing time to widget vertices. allow objects past platform max y in belt mode
This commit is contained in:
parent
61bff786ea
commit
cbf003f214
5 changed files with 29 additions and 14 deletions
1
notes.md
1
notes.md
|
|
@ -14,6 +14,7 @@
|
||||||
* `P` client/worker interface normalization
|
* `P` client/worker interface normalization
|
||||||
* `P` explore widget vertex reloading / replacing (Onshape primarily)
|
* `P` explore widget vertex reloading / replacing (Onshape primarily)
|
||||||
|
|
||||||
|
* `F` expose grouping feature
|
||||||
* `F` SVG import to 3D part like images
|
* `F` SVG import to 3D part like images
|
||||||
* `F` bundle current profile into exported device
|
* `F` bundle current profile into exported device
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -491,8 +491,8 @@
|
||||||
$('admin-gridlocal').onclick = admin_gridlocal;
|
$('admin-gridlocal').onclick = admin_gridlocal;
|
||||||
} catch (e) { console.log(e) }
|
} catch (e) { console.log(e) }
|
||||||
|
|
||||||
// preview of the generated GCODE
|
// preview of the generated GCODE (first 64k max)
|
||||||
if (preview && gcode) $('code-preview-textarea').value = gcode;
|
if (preview && gcode) $('code-preview-textarea').value = gcode.substring(0,65535);
|
||||||
|
|
||||||
// show dialog
|
// show dialog
|
||||||
API.modal.show('print');
|
API.modal.show('print');
|
||||||
|
|
|
||||||
|
|
@ -855,7 +855,15 @@
|
||||||
totalProgress,
|
totalProgress,
|
||||||
track = {},
|
track = {},
|
||||||
mode = settings.mode,
|
mode = settings.mode,
|
||||||
now = Date.now();
|
now = Date.now(),
|
||||||
|
totvert = 0,
|
||||||
|
defvert;
|
||||||
|
|
||||||
|
// determing this widgets % of processing time estimated by vertex count
|
||||||
|
for (let widget of WIDGETS) {
|
||||||
|
totvert += widget.getVertices().count;
|
||||||
|
}
|
||||||
|
defvert = totvert / WIDGETS.length;
|
||||||
|
|
||||||
setOpacity(color.slicing_opacity);
|
setOpacity(color.slicing_opacity);
|
||||||
|
|
||||||
|
|
@ -872,7 +880,8 @@
|
||||||
startTime = Date.now(),
|
startTime = Date.now(),
|
||||||
lastMsg,
|
lastMsg,
|
||||||
camOrLaser = mode === 'CAM' || mode === 'LASER',
|
camOrLaser = mode === 'CAM' || mode === 'LASER',
|
||||||
stack = widget.stack = STACKS.create(widget.id, widget.mesh);
|
stack = widget.stack = STACKS.create(widget.id, widget.mesh),
|
||||||
|
factor = (widget.getVertices().count / defvert);
|
||||||
|
|
||||||
widget.stats.progress = 0;
|
widget.stats.progress = 0;
|
||||||
widget.setColor(color.slicing);
|
widget.setColor(color.slicing);
|
||||||
|
|
@ -889,6 +898,7 @@
|
||||||
}
|
}
|
||||||
// on the last exit, update ui and call the callback
|
// on the last exit, update ui and call the callback
|
||||||
if (--countdown === 0 || error || errored) {
|
if (--countdown === 0 || error || errored) {
|
||||||
|
let alert = scale === 1 ? API.show.alert("Rendering") : null;
|
||||||
KIRI.client.unrotate(settings, () => {
|
KIRI.client.unrotate(settings, () => {
|
||||||
forAllWidgets(widget => {
|
forAllWidgets(widget => {
|
||||||
// on done
|
// on done
|
||||||
|
|
@ -902,6 +912,7 @@
|
||||||
widget.setWireframe(false, color.wireframe, color.wireframe_opacity);
|
widget.setWireframe(false, color.wireframe, color.wireframe_opacity);
|
||||||
widget.setOpacity(camOrLaser ? color.cam_sliced_opacity : color.sliced_opacity);
|
widget.setOpacity(camOrLaser ? color.cam_sliced_opacity : color.sliced_opacity);
|
||||||
widget.setColor(color.deselected);
|
widget.setColor(color.deselected);
|
||||||
|
API.hide.alert(alert);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
updateSliderMax(true);
|
updateSliderMax(true);
|
||||||
|
|
@ -939,7 +950,7 @@
|
||||||
startTime = mark;
|
startTime = mark;
|
||||||
}
|
}
|
||||||
// on update
|
// on update
|
||||||
track[widget.id] = update;
|
track[widget.id] = (update || 0) * factor;
|
||||||
totalProgress = 0;
|
totalProgress = 0;
|
||||||
forAllWidgets(function(w) {
|
forAllWidgets(function(w) {
|
||||||
totalProgress += (track[w.id] || 0);
|
totalProgress += (track[w.id] || 0);
|
||||||
|
|
@ -965,7 +976,6 @@
|
||||||
|
|
||||||
hideSlider(true);
|
hideSlider(true);
|
||||||
|
|
||||||
let alert = API.show.alert("Preparing Preview");
|
|
||||||
let isCam = MODE === MODES.CAM, pMode = getMode();
|
let isCam = MODE === MODES.CAM, pMode = getMode();
|
||||||
|
|
||||||
if (feature.preview) {
|
if (feature.preview) {
|
||||||
|
|
@ -1008,11 +1018,11 @@
|
||||||
segtimes[`${segNumber++}_${lastMsg}`] = Date.now() - startTime;
|
segtimes[`${segNumber++}_${lastMsg}`] = Date.now() - startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
API.hide.alert(alert);
|
|
||||||
API.show.progress(0);
|
API.show.progress(0);
|
||||||
if (!isCam) setOpacity(0);
|
if (!isCam) setOpacity(0);
|
||||||
|
|
||||||
if (feature.preview && output.length) {
|
if (feature.preview && output.length) {
|
||||||
|
let alert = API.show.alert("Rendering")
|
||||||
startTime = Date.now();
|
startTime = Date.now();
|
||||||
STACKS.clear();
|
STACKS.clear();
|
||||||
const stack = STACKS.create('print', SPACE.platform.world)
|
const stack = STACKS.create('print', SPACE.platform.world)
|
||||||
|
|
@ -1026,6 +1036,7 @@
|
||||||
ri.dy = settings.device.bedDepth / 2;
|
ri.dy = settings.device.bedDepth / 2;
|
||||||
stack.obj.rotate(WIDGETS[0].rotinfo);
|
stack.obj.rotate(WIDGETS[0].rotinfo);
|
||||||
}
|
}
|
||||||
|
API.hide.alert(alert);
|
||||||
segtimes[`${segNumber}_draw`] = Date.now() - startTime;
|
segtimes[`${segNumber}_draw`] = Date.now() - startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1193,6 +1204,7 @@
|
||||||
|
|
||||||
function updateSelectedBounds() {
|
function updateSelectedBounds() {
|
||||||
// update bounds on selection for drag limiting
|
// update bounds on selection for drag limiting
|
||||||
|
let isBelt = settings.device.bedBelt;
|
||||||
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();
|
||||||
|
|
@ -1206,7 +1218,7 @@
|
||||||
|
|
||||||
// keep widget in bounds when rotated or scaled
|
// keep widget in bounds when rotated or scaled
|
||||||
let ylo = miny < 0;
|
let ylo = miny < 0;
|
||||||
let yhi = maxy > dvy
|
let yhi = !isBelt && maxy > dvy
|
||||||
if (ylo && !yhi) {
|
if (ylo && !yhi) {
|
||||||
widget.move(0, -miny, 0);
|
widget.move(0, -miny, 0);
|
||||||
} else if (yhi && !ylo) {
|
} else if (yhi && !ylo) {
|
||||||
|
|
|
||||||
|
|
@ -258,6 +258,10 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
PRO.getVertices = function() {
|
||||||
|
return this.mesh.geometry.attributes.position;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {THREE.Geometry} geometry
|
* @param {THREE.Geometry} geometry
|
||||||
* @returns {Widget}
|
* @returns {Widget}
|
||||||
|
|
|
||||||
|
|
@ -35,8 +35,7 @@
|
||||||
firstLayerMult = process.firstLayerPrintMult,
|
firstLayerMult = process.firstLayerPrintMult,
|
||||||
firstLayerBrim = process.firstLayerBrim,
|
firstLayerBrim = process.firstLayerBrim,
|
||||||
firstLayerBrimTrig = process.firstLayerBrimTrig,
|
firstLayerBrimTrig = process.firstLayerBrimTrig,
|
||||||
maxLayers = 0,
|
layerno = 0,
|
||||||
layer = 0,
|
|
||||||
zoff = 0,
|
zoff = 0,
|
||||||
meshIndex,
|
meshIndex,
|
||||||
lastIndex,
|
lastIndex,
|
||||||
|
|
@ -231,7 +230,6 @@
|
||||||
// find max layers (for updates)
|
// find max layers (for updates)
|
||||||
// generate list of used extruders for purge blocks
|
// generate list of used extruders for purge blocks
|
||||||
for (let widget of widgets) {
|
for (let widget of widgets) {
|
||||||
maxLayers = Math.max(maxLayers, widget.slices.length);
|
|
||||||
let extruder = (settings.widget[widget.id] || {}).extruder || 0;
|
let extruder = (settings.widget[widget.id] || {}).extruder || 0;
|
||||||
if (!extruders[extruder]) {
|
if (!extruders[extruder]) {
|
||||||
extruders[extruder] = {};
|
extruders[extruder] = {};
|
||||||
|
|
@ -426,13 +424,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// retract after last layer
|
// retract after last layer
|
||||||
if (layer === maxLayers && layerout.length) {
|
if (layerno === cake.length - 1 && layerout.length) {
|
||||||
layerout.last().retract = true;
|
layerout.last().retract = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// notify progress
|
// notify progress
|
||||||
layerout.layer = layer++;
|
layerout.layer = layerno++;
|
||||||
update((layer / maxLayers) * 0.5, "prepare");
|
update((layerno / cake.length) * 0.5, "prepare");
|
||||||
|
|
||||||
slices = [];
|
slices = [];
|
||||||
layerout = [];
|
layerout = [];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue