bump rev 2.6.D11. rework rotation and bounds (again)
This commit is contained in:
parent
a82c62b73a
commit
6ba89b1b8f
6 changed files with 28 additions and 34 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "grid-apps",
|
||||
"version": "2.6.10D",
|
||||
"version": "2.6.11D",
|
||||
"description": "grid.space 3d slice & modeling tools",
|
||||
"author": "Stewart Allen <sa@grid.space>",
|
||||
"license": "MIT",
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
if (!self.kiri) {
|
||||
self.kiri = {
|
||||
beta: 2610,
|
||||
beta: 2611,
|
||||
driver: {}, // driver modules
|
||||
loader: [] // module loading: array of functions
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2182,7 +2182,7 @@
|
|||
function init_two() {
|
||||
API.event.emit('init.two');
|
||||
|
||||
API.space.set_focus();
|
||||
// API.space.set_focus();
|
||||
|
||||
// call driver initializations, if present
|
||||
Object.values(KIRI.driver).forEach(driver => {
|
||||
|
|
|
|||
|
|
@ -85,44 +85,36 @@ KIRI.worker = {
|
|||
return send.done({});
|
||||
}
|
||||
|
||||
function mins(vert) {
|
||||
let miny = Infinity, minz = Infinity;
|
||||
function mins(vert, last = {}) {
|
||||
let miny = last.miny || Infinity,
|
||||
maxy = last.maxy || -Infinity;
|
||||
for (let i=0, l=vert.length; i<l; ) {
|
||||
let x = vert[i++];
|
||||
let y = vert[i++];
|
||||
let z = vert[i++];
|
||||
miny = Math.min(miny, y);
|
||||
minz = Math.min(minz, z);
|
||||
if (z < 0.01) {
|
||||
miny = Math.min(miny, y);
|
||||
maxy = Math.max(maxy, y);
|
||||
}
|
||||
}
|
||||
return {miny, minz};
|
||||
return { miny, maxy };
|
||||
}
|
||||
|
||||
for (let group of Object.values(wgroup)) {
|
||||
let minv = {};
|
||||
for (let w of group) {
|
||||
minv = mins(w.vertices, minv);
|
||||
}
|
||||
let { miny, maxy } = minv;
|
||||
|
||||
let widget = group[0];
|
||||
let rotation = (Math.PI / 180) * 45;
|
||||
|
||||
// need min y for post-rotation offset in prepare
|
||||
// let vert = widget.vertices;
|
||||
// let miny = Infinity;
|
||||
// for (let i=0, l=vert.length; i<l; ) {
|
||||
// let x = vert[i++];
|
||||
// let y = vert[i++];
|
||||
// let z = vert[i++];
|
||||
// if (z < 0.01) miny = Math.min(miny, y);
|
||||
// }
|
||||
|
||||
let min1 = mins(widget.vertices);
|
||||
let miny = min1.miny;
|
||||
|
||||
widget.groupBounds();
|
||||
let track = widget.track;
|
||||
let xpos = track.pos.x;
|
||||
let ypos = settings.device.bedDepth / 2 + track.pos.y + miny;
|
||||
|
||||
widget.rotate(rotation,0,0,true);
|
||||
widget.groupBounds();
|
||||
let rotation = (Math.PI / 180) * 45;
|
||||
|
||||
widget.belt = { xpos, ypos };
|
||||
widget.rotate(rotation,0,0,true);
|
||||
for (let others of group.slice(1)) {
|
||||
others.belt = widget.belt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
let terms = {
|
||||
COPYRIGHT: "Copyright (C) Stewart Allen <sa@grid.space> - All Rights Reserved",
|
||||
LICENSE: "See the license.md file included with the source distribution",
|
||||
VERSION: "2.6.D10"
|
||||
VERSION: "2.6.D11"
|
||||
};
|
||||
|
||||
if (typeof(module) === 'object') {
|
||||
|
|
|
|||
|
|
@ -291,12 +291,14 @@
|
|||
for (let widget of widgets) {
|
||||
let { rotinfo, belt } = widget;
|
||||
let offset = Object.clone(widget.track.pos);
|
||||
// let offset = widget.mesh ? Object.clone(widget.mesh.position) : {x:0, y:0, z:0};
|
||||
if (isBelt) {
|
||||
offset.x = rotinfo.xpos;
|
||||
offset.y = -belt.midy;
|
||||
offset.y += rotinfo.ypos * beltfact;
|
||||
offset.z = rotinfo.ypos * beltfact;
|
||||
let o = rotinfo.ypos * beltfact;
|
||||
offset = {
|
||||
x: rotinfo.xpos,
|
||||
y: o - belt.midy,// - belt.miny,
|
||||
z: o,
|
||||
};
|
||||
// offset = { x:0, y:0, z:0 };
|
||||
// locate the lowest point in slices and widget overall
|
||||
let minby = Infinity;
|
||||
for (let slice of widget.slices) {
|
||||
|
|
@ -412,7 +414,7 @@
|
|||
// if a declared extruder isn't used in a layer, use selected
|
||||
// extruder to fill the relevant purge blocks for later support
|
||||
track.forEach(ext => {
|
||||
if (ext) {
|
||||
if (ext && lastOut) {
|
||||
printPoint = purge(ext.extruder, track, layerout, printPoint, lastOut.z, lastExt);
|
||||
}
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue