checkpoint new support / rotation work
This commit is contained in:
parent
af0111cb32
commit
dba922753c
9 changed files with 250 additions and 158 deletions
|
|
@ -20,6 +20,18 @@
|
|||
FDM.init = function(kiri, api) {
|
||||
API = api;
|
||||
SPACE = api.const.SPACE;
|
||||
|
||||
function filterSynth() {
|
||||
// remove synth widgets
|
||||
api.widgets.filter((widget) => {
|
||||
if (widget.track.synth) {
|
||||
api.const.SPACE.platform.remove(widget.mesh);
|
||||
kiri.Widget.Groups.remove(widget);
|
||||
}
|
||||
return !widget.track.synth
|
||||
});
|
||||
}
|
||||
|
||||
api.event.on("mode.set", mode => {
|
||||
isFdmMode = mode === 'FDM';
|
||||
lastMode = mode;
|
||||
|
|
@ -28,6 +40,7 @@
|
|||
api.event.on("view.set", view => {
|
||||
lastView = view;
|
||||
updateVisiblity();
|
||||
filterSynth();
|
||||
});
|
||||
api.event.on("settings.load", (settings) => {
|
||||
if (settings.mode !== 'FDM') return;
|
||||
|
|
@ -98,6 +111,37 @@
|
|||
}
|
||||
func.sdone();
|
||||
updateVisiblity();
|
||||
|
||||
// synth support widget for each widget group
|
||||
let synth = [];
|
||||
for (let group of kiri.Widget.Groups.list()) {
|
||||
let count = 0;
|
||||
let merged = new THREE.Geometry();
|
||||
for (let widget of group) {
|
||||
if (widget.sups) {
|
||||
for (let sup of Object.values(widget.sups)) {
|
||||
merged.merge(sup.box.geometry, sup.box.matrix);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!count) {
|
||||
continue;
|
||||
}
|
||||
let bbg = new THREE.BufferGeometry().fromGeometry(merged);
|
||||
let sw = kiri.newWidget(null, group);
|
||||
let fwp = group[0].track.pos;
|
||||
sw.loadGeometry(bbg);
|
||||
sw._move(fwp.x, fwp.y, fwp.z);
|
||||
api.widgets.add(sw);
|
||||
sw.track.synth = true;
|
||||
api.const.SPACE.platform.add(sw.mesh);
|
||||
}
|
||||
});
|
||||
api.event.on("slice.end", () => {
|
||||
if (!isFdmMode) {
|
||||
return;
|
||||
}
|
||||
});
|
||||
api.event.on("key.esc", () => {
|
||||
if (!isFdmMode) {
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@
|
|||
// nest and offset tops
|
||||
POLY.nest(tops).forEach(function(poly) {
|
||||
poly.offset(-offset + nozzle / 2).forEach(function(brim) {
|
||||
brim.move(widget.mesh.position);
|
||||
brim.move(widget.track.pos);
|
||||
brims.push(brim);
|
||||
});
|
||||
});
|
||||
|
|
@ -290,7 +290,8 @@
|
|||
// establish offsets
|
||||
for (let widget of widgets) {
|
||||
let { rotinfo, belt } = widget;
|
||||
let offset = widget.mesh ? Object.clone(widget.mesh.position) : {x:0, y:0, z:0};
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -199,8 +199,9 @@
|
|||
});
|
||||
|
||||
// fixed supports (generated ahead of time)
|
||||
const fixed = Object.values(settings.widget[widget.id].support || {});
|
||||
let shadow = null;
|
||||
let wannot = settings.widget[widget.id] || {},
|
||||
fixed = Object.values(wannot.support || {}),
|
||||
shadow = null;
|
||||
if (fixed.length || spro.sliceSupportEnable) {
|
||||
// create shadow. TODO test if any supports set
|
||||
let alltops = slices.map(slice => slice.topPolys()).flat();
|
||||
|
|
@ -284,7 +285,7 @@
|
|||
doSupportFill(slice, lineWidth, spro.sliceSupportDensity, minArea);
|
||||
}, "support");
|
||||
} else if (true) {
|
||||
doSupportBelt(slices, spro, fixed, shadow, doupdate);
|
||||
// doSupportBelt(slices, spro, fixed, shadow, doupdate);
|
||||
}
|
||||
|
||||
// render if not explicitly disabled
|
||||
|
|
|
|||
Loading…
Reference in a new issue