You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Fixed
lay_flat rests a model on a face that is its real bottom. Before, it turned the face-normal group with the largest area to face down and moved the lowest point to Z=0, without checking that those faces were the lowest. The stove gap filler from Scan to Make (six T strips) printed upside down: its cap undersides' 23,838 mm² face down but sit 12 mm above the fin tips, so it stood on its fins.
A pose qualifies only when some face, turned down, lies on the rotated model's lowest plane, within 0.5% of its height and at most 0.2 mm. The candidate poses are the 64 largest face groups and the model's six axes, so a domed part can flip exactly.
Among qualifying poses, lay_flat picks the one with the least part and support volume per mm² of bed contact. Support is the overhang more than 45° from vertical, times its height above the bed. Ties go to the larger contact, then to the face that already points down.
When no pose qualifies, the model is unchanged. The text result is still the STL path, and the new structuredContent{path, laid_flat, message} says why.
The gap filler now comes out cap-down, fin tips 14.4 mm up. This is checked from the output vertices only. The same rule in bambu-printer-mcp was also checked by slicing with Bambu Studio 02.08.02.61 for a P1S, which gave no warning; that slice was not repeated here.
slice_stl returns Bambu Studio's own checks on the Bambu-compatible CLI route, and OrcaSlicer's where it writes the same result.json. When the CLI writes result.json (Bambu Studio 02.08.02.61 writes it on macOS on success too), structuredContent.slicer_result carries it parsed and unchanged: error_string, return_code and each sliced_plates[].warning_message. Before, the run's output directory was deleted with result.json in it, and warnings such as "It seems object … has floating cantilever. Please re-orient the object or enable support generation." were lost.
The text result stays the sliced file's path.
A failed slice is an error result whose text starts with Studio's error_string (unless it reports success), then each plate's warning_message, then the exit code, slicer output and suggestion, with no Error: prefix. Its structuredContent carries slicer_result beside the existing slicer details.
A result.json reporting a nonzero return_code fails the slice even when the CLI exits 0.
The G-code slicers (PrusaSlicer, Cura, Slic3r, generic OrcaSlicer without a Bambu preset) write no result.json and return structuredContent{path} only.
Tested with real result.json files from Bambu Studio 02.08.02.61 slicing the Scan to Make stove gap filler for a P1S on macOS, replayed by a fake CLI. The optional installed-Studio test also checks slicer_result on macOS; CI skips it. OrcaSlicer's result.json follows the same libslic3r format but was not run here.