add slicing on a bias
This commit is contained in:
parent
fe8de60f58
commit
c7d5b0b825
7 changed files with 63 additions and 14 deletions
|
|
@ -122,7 +122,7 @@ var gs_kiri_codec = exports;
|
||||||
inner: encode(this.inner, state),
|
inner: encode(this.inner, state),
|
||||||
// thinner: encode(this.thinner, state),
|
// thinner: encode(this.thinner, state),
|
||||||
solids: encode(this.solids, state),
|
solids: encode(this.solids, state),
|
||||||
fill_lines: encodePointArray(this.fill_lines),
|
fill_lines: encodePointArray(this.fill_lines, state),
|
||||||
fill_sparse: encode(this.fill_sparse, state),
|
fill_sparse: encode(this.fill_sparse, state),
|
||||||
polish: encode(this.polish, state)
|
polish: encode(this.polish, state)
|
||||||
};
|
};
|
||||||
|
|
@ -142,13 +142,27 @@ var gs_kiri_codec = exports;
|
||||||
return top;
|
return top;
|
||||||
});
|
});
|
||||||
|
|
||||||
function encodePointArray(points) {
|
function encodePointArray(points, state) {
|
||||||
if (!points) return null;
|
if (!points) return null;
|
||||||
|
|
||||||
var array = new Float32Array(points.length * 3),
|
var array = new Float32Array(points.length * 3),
|
||||||
pos = 0;
|
pos = 0;
|
||||||
|
|
||||||
points.forEach(function(point) {
|
points.forEach(function(point) {
|
||||||
|
if (state.rotate) {
|
||||||
|
if (state.centerz) {
|
||||||
|
point.z -= state.centerz;
|
||||||
|
}
|
||||||
|
let v = new THREE.Vector3(point.x, point.y, point.z);
|
||||||
|
v.applyMatrix4(state.rotate);
|
||||||
|
point = {x: v.x, y: v.y, z: v.z};
|
||||||
|
if (state.centerz) {
|
||||||
|
point.z += state.centerz;
|
||||||
|
}
|
||||||
|
if (state.movez) {
|
||||||
|
point.z -= state.movez;
|
||||||
|
}
|
||||||
|
}
|
||||||
array[pos++] = point.x;
|
array[pos++] = point.x;
|
||||||
array[pos++] = point.y;
|
array[pos++] = point.y;
|
||||||
array[pos++] = point.z;
|
array[pos++] = point.z;
|
||||||
|
|
@ -188,11 +202,11 @@ var gs_kiri_codec = exports;
|
||||||
return {
|
return {
|
||||||
type: 'poly',
|
type: 'poly',
|
||||||
id: this.id,
|
id: this.id,
|
||||||
array: encodePointArray(this.points),
|
array: encodePointArray(this.points, state),
|
||||||
open: this.isOpen(),
|
open: this.isOpen(),
|
||||||
inner: encode(this.inner, state),
|
inner: encode(this.inner, state),
|
||||||
parent: encode(this.parent, state),
|
parent: encode(this.parent, state),
|
||||||
fills: encodePointArray(this.fills),
|
fills: encodePointArray(this.fills, state),
|
||||||
depth: this.depth
|
depth: this.depth
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -282,7 +282,8 @@ let gs_kiri_conf = exports;
|
||||||
sliceMinHeight: 0,
|
sliceMinHeight: 0,
|
||||||
zHopDistance: 0.2,
|
zHopDistance: 0.2,
|
||||||
antiBacklash: 1,
|
antiBacklash: 1,
|
||||||
gcodePause: ""
|
gcodePause: "",
|
||||||
|
sliceRotation: 0
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sla:{
|
sla:{
|
||||||
|
|
|
||||||
|
|
@ -1447,6 +1447,7 @@ var gs_kiri_init = exports;
|
||||||
outputShortPoly: UC.newInput(LANG.ad_spol_s, {title:LANG.ad_spol_l, bound:UC.bound(0,200), convert:UC.toFloat, modes:FDM, expert:true}),
|
outputShortPoly: UC.newInput(LANG.ad_spol_s, {title:LANG.ad_spol_l, bound:UC.bound(0,200), convert:UC.toFloat, modes:FDM, expert:true}),
|
||||||
zHopDistance: UC.newInput(LANG.ad_zhop_s, {title:LANG.ad_zhop_l, bound:UC.bound(0,3.0), convert:UC.toFloat, modes:FDM, expert:true}),
|
zHopDistance: UC.newInput(LANG.ad_zhop_s, {title:LANG.ad_zhop_l, bound:UC.bound(0,3.0), convert:UC.toFloat, modes:FDM, expert:true}),
|
||||||
antiBacklash: UC.newInput(LANG.ad_abkl_s, {title:LANG.ad_abkl_l, bound:UC.bound(0,3), convert:UC.toInt, modes:FDM, expert:true}),
|
antiBacklash: UC.newInput(LANG.ad_abkl_s, {title:LANG.ad_abkl_l, bound:UC.bound(0,3), convert:UC.toInt, modes:FDM, expert:true}),
|
||||||
|
sliceRotation: UC.newInput(LANG.ad_slrt_s, {title:LANG.ad_slrt_l, bound:UC.bound(-45,45), convert:UC.toFloat, modes:FDM, expert:true}),
|
||||||
// detectThinWalls: UC.newBoolean("thin wall fill", onBooleanClick, {title: "detect and fill thin openings\nbetween shells walls", modes:FDM, expert:true})
|
// detectThinWalls: UC.newBoolean("thin wall fill", onBooleanClick, {title: "detect and fill thin openings\nbetween shells walls", modes:FDM, expert:true})
|
||||||
gcodePauseLayers: UC.newInput(LANG.ag_paws_s, {title:LANG.ag_paws_l, modes:FDM, expert:true, comma:true}),
|
gcodePauseLayers: UC.newInput(LANG.ag_paws_s, {title:LANG.ag_paws_l, modes:FDM, expert:true, comma:true}),
|
||||||
outputLayerRetract: UC.newBoolean(LANG.ad_lret_s, onBooleanClick, {title:LANG.ad_lret_l, modes:FDM, expert:true}),
|
outputLayerRetract: UC.newBoolean(LANG.ad_lret_s, onBooleanClick, {title:LANG.ad_lret_l, modes:FDM, expert:true}),
|
||||||
|
|
|
||||||
|
|
@ -532,15 +532,17 @@ let gs_kiri_widget = exports;
|
||||||
|
|
||||||
PRO.rotate = function(x, y, z) {
|
PRO.rotate = function(x, y, z) {
|
||||||
this.group.forEach(w => {
|
this.group.forEach(w => {
|
||||||
w._rotate(x, y, z);
|
w._rotate(x, y, z, false);
|
||||||
});
|
});
|
||||||
this.center();
|
this.center();
|
||||||
};
|
};
|
||||||
|
|
||||||
PRO._rotate = function(x, y, z) {
|
PRO._rotate = function(x, y, z, temp) {
|
||||||
|
if (!temp) {
|
||||||
this.bounds = null;
|
this.bounds = null;
|
||||||
this.setWireframe(false);
|
this.setWireframe(false);
|
||||||
this.clearSlices();
|
this.clearSlices();
|
||||||
|
}
|
||||||
let m4 = new THREE.Matrix4();
|
let m4 = new THREE.Matrix4();
|
||||||
let euler = typeof(x) === 'number';
|
let euler = typeof(x) === 'number';
|
||||||
if (euler) {
|
if (euler) {
|
||||||
|
|
@ -549,7 +551,7 @@ let gs_kiri_widget = exports;
|
||||||
m4 = m4.makeRotationFromQuaternion(x);
|
m4 = m4.makeRotationFromQuaternion(x);
|
||||||
}
|
}
|
||||||
this.mesh.geometry.applyMatrix4(m4);
|
this.mesh.geometry.applyMatrix4(m4);
|
||||||
if (euler) {
|
if (!temp && euler) {
|
||||||
let rot = this.track.rot;
|
let rot = this.track.rot;
|
||||||
rot.x += (x || 0);
|
rot.x += (x || 0);
|
||||||
rot.y += (y || 0);
|
rot.y += (y || 0);
|
||||||
|
|
|
||||||
|
|
@ -88,8 +88,23 @@ KIRI.work = {
|
||||||
},
|
},
|
||||||
|
|
||||||
slice : function(settings, widget, callback) {
|
slice : function(settings, widget, callback) {
|
||||||
|
let rotation = (Math.PI/180) * (settings.process.sliceRotation || 0);
|
||||||
|
let centerz;
|
||||||
|
let movez;
|
||||||
|
if (rotation) {
|
||||||
|
let bbox1 = widget.getBoundingBox(true);
|
||||||
|
widget._rotate(0,rotation,0,true);
|
||||||
|
widget.center();
|
||||||
|
let bbox2 = widget.getBoundingBox(true);
|
||||||
|
centerz = (bbox2.max.z - bbox2.min.z)/2;
|
||||||
|
movez = centerz - (bbox1.max.z - bbox1.min.z)/2;
|
||||||
|
}
|
||||||
let vertices = widget.getGeoVertices().buffer.slice(0),
|
let vertices = widget.getGeoVertices().buffer.slice(0),
|
||||||
snapshot = KIRI.api.view.snapshot;
|
snapshot = KIRI.api.view.snapshot;
|
||||||
|
if (rotation) {
|
||||||
|
widget._rotate(0,-rotation,0,true);
|
||||||
|
widget.center();
|
||||||
|
}
|
||||||
slicing[widget.id] = callback;
|
slicing[widget.id] = callback;
|
||||||
send("slice", {
|
send("slice", {
|
||||||
id: widget.id,
|
id: widget.id,
|
||||||
|
|
@ -97,7 +112,13 @@ KIRI.work = {
|
||||||
vertices: vertices,
|
vertices: vertices,
|
||||||
position: widget.mesh.position,
|
position: widget.mesh.position,
|
||||||
tracking: widget.track,
|
tracking: widget.track,
|
||||||
snapshot: snapshot
|
snapshot: snapshot,
|
||||||
|
// for rotation / unrotation
|
||||||
|
state: {
|
||||||
|
rotation: rotation,
|
||||||
|
centerz: centerz,
|
||||||
|
movez: movez
|
||||||
|
}
|
||||||
}, function(reply) {
|
}, function(reply) {
|
||||||
if (reply.done || reply.error) delete slicing[widget.id];
|
if (reply.done || reply.error) delete slicing[widget.id];
|
||||||
callback(reply);
|
callback(reply);
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,15 @@ let dispatch = {
|
||||||
vertices = new Float32Array(data.vertices),
|
vertices = new Float32Array(data.vertices),
|
||||||
position = data.position,
|
position = data.position,
|
||||||
tracking = data.tracking,
|
tracking = data.tracking,
|
||||||
points = Widget.verticesToPoints(vertices);
|
points = Widget.verticesToPoints(vertices),
|
||||||
|
state = data.state || {},
|
||||||
|
rotation = state.rotation,
|
||||||
|
centerz = state.centerz,
|
||||||
|
movez = state.movez;
|
||||||
|
|
||||||
|
if (rotation) {
|
||||||
|
state.rotate = new THREE.Matrix4().makeRotationY(-rotation);
|
||||||
|
}
|
||||||
|
|
||||||
send.data({update:0.05, updateStatus:"slicing"});
|
send.data({update:0.05, updateStatus:"slicing"});
|
||||||
|
|
||||||
|
|
@ -72,7 +80,7 @@ let dispatch = {
|
||||||
slices: slices.length
|
slices: slices.length
|
||||||
});
|
});
|
||||||
slices.forEach(function(slice,index) {
|
slices.forEach(function(slice,index) {
|
||||||
send.data({index: index, slice: slice.encode()});
|
send.data({index: index, slice: slice.encode(state)});
|
||||||
})
|
})
|
||||||
if (self.debug && widget.polish) {
|
if (self.debug && widget.polish) {
|
||||||
send.data({polish: kiri.codec.encode(widget.polish)});
|
send.data({polish: kiri.codec.encode(widget.polish)});
|
||||||
|
|
|
||||||
|
|
@ -376,6 +376,8 @@ kiri.lang['en-us'] = {
|
||||||
ad_zhop_l: "amount to raise z\non retraction moves\nin millimeters\n0 to disable",
|
ad_zhop_l: "amount to raise z\non retraction moves\nin millimeters\n0 to disable",
|
||||||
ad_abkl_s: "anti-backlash",
|
ad_abkl_s: "anti-backlash",
|
||||||
ad_abkl_l: "use micro-movements to cancel\nbacklash during fills\nin millimeters",
|
ad_abkl_l: "use micro-movements to cancel\nbacklash during fills\nin millimeters",
|
||||||
|
ad_slrt_s: "slice rotation",
|
||||||
|
ad_slrt_l: "slice object on a bias\nangle in the y axis.\nuseful for extremely\nlarge format prints",
|
||||||
ad_lret_s: "layer retract",
|
ad_lret_s: "layer retract",
|
||||||
ad_lret_l: "force filament retraction\nbetween layers",
|
ad_lret_l: "force filament retraction\nbetween layers",
|
||||||
ad_play_s: "polish layers",
|
ad_play_s: "polish layers",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue