add belt docs and preserve belt transformations
This commit is contained in:
parent
38d040b190
commit
dce90fab07
1 changed files with 31 additions and 5 deletions
|
|
@ -493,15 +493,25 @@ export async function fdm_prepare(widgets, settings, update) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// establish offsets
|
/**
|
||||||
|
* Establish widget offsets
|
||||||
|
*
|
||||||
|
* For belt printers: Apply trigonometric transformation from Y-axis position
|
||||||
|
* to inclined belt coordinate system using widget.belt properties (cosf, sinf, ypos)
|
||||||
|
*
|
||||||
|
* For normal printers: Use widget position plus any raft offset
|
||||||
|
*
|
||||||
|
* Note: This must run BEFORE support widgets are created, as they inherit
|
||||||
|
* both the offset and belt properties from their parent widget.
|
||||||
|
*/
|
||||||
for (let widget of widgets) {
|
for (let widget of widgets) {
|
||||||
let { belt } = widget;
|
let { belt } = widget;
|
||||||
let offset = Object.clone(widget.track.pos);
|
let offset = Object.clone(widget.track.pos);
|
||||||
if (isBelt) {
|
if (isBelt) {
|
||||||
offset = {
|
offset = {
|
||||||
x: belt.xpos,
|
x: belt.xpos,
|
||||||
y: belt.ypos * belt.cosf,
|
y: belt.ypos * belt.cosf, // Y component of inclined belt
|
||||||
z: belt.ypos * belt.sinf
|
z: belt.ypos * belt.sinf // Z component of inclined belt
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// when rafts used this is non-zero
|
// when rafts used this is non-zero
|
||||||
|
|
@ -510,12 +520,27 @@ export async function fdm_prepare(widgets, settings, update) {
|
||||||
widget.offset = offset;
|
widget.offset = offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
// for any widget with supports, create a new widget for them
|
/**
|
||||||
|
* Extract support structures into separate synthetic widgets
|
||||||
|
*
|
||||||
|
* Support structures use a different extruder (sliceSupportNozzle) and need
|
||||||
|
* to be processed independently. This creates new "virtual" widgets containing
|
||||||
|
* only support geometry.
|
||||||
|
*
|
||||||
|
* CRITICAL for belt mode: Must copy belt properties to maintain proper positioning
|
||||||
|
* - widget.belt: Required for offset calculations if widget list is reprocessed
|
||||||
|
* - slice.belt.anchor: Used to mark layers that touch the belt (line 667)
|
||||||
|
* - slice.belt.touch: Affects print start position logic (line 676)
|
||||||
|
*
|
||||||
|
* Without belt property copying, supports render in incorrect positions because
|
||||||
|
* the belt coordinate transformations (cosf, sinf, ypos) are not applied.
|
||||||
|
*/
|
||||||
for (let widget of widgets.slice()) {
|
for (let widget of widgets.slice()) {
|
||||||
let slices = [];
|
let slices = [];
|
||||||
for (let slice of widget.slices) {
|
for (let slice of widget.slices) {
|
||||||
if (slice.supports) {
|
if (slice.supports) {
|
||||||
let nslice = newSlice(slice.z);
|
let nslice = newSlice(slice.z);
|
||||||
|
nslice.belt = slice.belt;
|
||||||
nslice.height = slice.height;
|
nslice.height = slice.height;
|
||||||
nslice.index = slice.index;
|
nslice.index = slice.index;
|
||||||
nslice.supports = slice.supports;
|
nslice.supports = slice.supports;
|
||||||
|
|
@ -527,7 +552,8 @@ export async function fdm_prepare(widgets, settings, update) {
|
||||||
let nwid = newWidget(null, widget.group);
|
let nwid = newWidget(null, widget.group);
|
||||||
nwid.support = true;
|
nwid.support = true;
|
||||||
nwid.slices = slices;
|
nwid.slices = slices;
|
||||||
nwid.offset = widget.offset;
|
nwid.offset = widget.offset; // inherit calculated offset from parent
|
||||||
|
nwid.belt = widget.belt; // inherit any belt transformations
|
||||||
widgets.push(nwid);
|
widgets.push(nwid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue