Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ All notable changes to Kromacut are documented in this file.
- **Pull request CI and `test:e2e:all`** - Pull requests into `develop` and `main`, and pushes to them, now run lint, the build, unit tests, the desktop app's Rust tests (`cargo test` on Linux, macOS, and Windows), and every Playwright e2e suite in parallel jobs, with cached npm packages, Chromium, and cargo builds. One `CI passed` check summarizes the result. Fork pull requests get a read-only token and no secrets. `npm run test:e2e:all` runs the same suites locally one after another: the `@smoke` tests, then the docs, landing, privacy, terms, 404, i18n, and i18n build suites, each on a fresh server. It fails if any suite fails, if a Playwright config isn't in the suite list, or if a test isn't run by any suite; the long `@full` export matrix stays on demand. Area specs now refuse to run under the wrong Playwright config and name the script to use. Palette Proof, the Settings legal links, and the adaptive Stack Matrix round trip were not in any suite and now run with `@smoke`.
- **Cats Exact benchmark reproducibility** - Audited the stale replay fingerprint against historical prediction changes while preserving captured observations and artifact hashes. Calibrated benchmarks capture provenance before optimization, pin archived source and provenance to one resolved commit, and save full results before golden assertions. CLI validation rejects invalid case/head/grouping selections and report paths that alias saved inputs, and checks replay results against preparation checksums; cached preparation requires an uncached Exact result and rejects mismatched physical/separation settings, repeat budgets, profiles, palettes, and model contexts. Fresh-stack multi-head measurements support warmed repeated samples, deterministic result checks, and separate fitting, optimization, analysis, and build-validation timing. The cats fixtures record the profile hash of the committed LF file instead of its Windows CRLF form, and `.kfil` and performance fixture JSON files are checked out byte-for-byte on every platform, so the immutability check passes on macOS and Linux; cached multi-head preparation still accepts results captured from CRLF checkouts of the same profile.
- **Multi-head printing guide** - New in-app documentation page explaining Multi-head printing: prerequisites, how layers become color runs and windows, the Head Schedule, the combination search space, Color grouping, and what Fast, Balanced, and Thorough search depth change, with four explanatory diagrams. The guide, navigation metadata, and diagrams are available in all 12 languages, with measured translated labels and reciprocal Auto-paint links. Covers routed preview colors, 3MF head assignments and M600 checkpoints, single-head fallback, and cancellation when the image changes. Regression checks require matching guide metadata and complete diagram catalogs and label bounds; browser coverage loads the guide and all four illustrations in every language.
- **Multi-head printing** - Auto-paint can analyze per-pixel filament orders across 2–8 heads in a background worker. Successful builds route every color region through its per-layer filament path and scheduled physical head; the preview shows each region’s predicted blend, corrected by the same calibration evidence as single-head builds, and can display its physical filament instead. All smoothing strengths share conforming region boundaries and closed layer geometry, with chunked generation to keep builds responsive. Multi-head 3MFs retain that geometry and physical filament colors, use the selected head count and head assignments, and insert M600 pause markers at exactly the Head Schedule’s swap checkpoints. Selected heads beyond the filament count remain EMPTY, and Center/Edge priorities use the same weighted targets as normal Auto-paint; colors with zero regional weight retain printable surfaces through palette matching and finite routing groups without changing weighted centroids. Fast/Balanced/Thorough controls search effort with bounded deterministic sampling. A **Color grouping** control chooses the search targets: Layer-based merges colors sharing a printer layer; Color-based keeps hues separate within a bounded group budget while preserving every member’s original print layer. At least one group is retained per occupied layer, including visible regions with zero regional weight, so capped palettes keep every printable color assigned without changing scoring weights. Color-based can produce more printed colors, but does not guarantee lower color error. Fast fitted-optics simulation nominates a bounded shortlist; windows and final region paths are scored with the full appearance model and usage-weighted CIEDE2000 on the original grouped colors. Fully scored assignments are reused when their physical context is unchanged, avoiding repeated broad searches during reconciliation. The current order remains available during reconciliation, and calibrated preview colors and the 0.25 minimum predicted gain gate are retained. Head count, search depth, color grouping, and the mode toggle persist through fallback builds and retain edits made during analysis; Multi-head and Flat Paint are mutually exclusive. Worker errors, unusable or non-improving plans, and plans whose predicted usage-weighted mean CIEDE2000 gain over the normal stack is below 0.25 retain the normal single-head model, with a notice and its original start color and swaps. Instructions follow the built snapshot, and before the first multi-head build **Copy** gives the same build prompt the panel shows, not single-head swaps; fallback builds copy their single-head plan. Image changes cancel pending analysis and discard obsolete builds. Controls, notices, schedules, copied text, and usage guides are localized into all 12 languages. Added region/filament routing, head/extruder, pause, smoothing/topology, fallback, predicted gain, async lifecycle, worker failure, and browser settings-persistence regression coverage. Color-group regressions cover capped palettes crossing physical layer boundaries, and calibrated image measurements use final-stack surfaces with CIEDE2000. Added full-model shortlist, proof-anchor, weighted reconciliation, seeded corrected multi-window routing, and bounded-evaluation regressions plus reproducible measured-profile cats/Rocco benchmarks; removed unused LUT analyzers and test-only assignment bookkeeping.
- **Multi-head printing** - Auto-paint can analyze per-pixel filament orders across 2–8 heads in a background worker. Successful builds route every color region through its per-layer filament path and scheduled physical head; the preview shows each region’s predicted blend, corrected by the same calibration evidence as single-head builds, and can display its physical filament instead. All smoothing strengths share conforming region boundaries and closed layer geometry, with chunked generation to keep builds responsive. Multi-head 3MFs retain that geometry and physical filament colors, use the selected head count and head assignments, and insert M600 pause markers at exactly the Head Schedule’s swap checkpoints. The download menu offers only 3MF for multi-head builds, as it does for Flat Paint, because STL can't carry head routing. Single-head fallback builds still offer STL. Selected heads beyond the filament count remain EMPTY, and Center/Edge priorities use the same weighted targets as normal Auto-paint; colors with zero regional weight retain printable surfaces through palette matching and finite routing groups without changing weighted centroids. Fast/Balanced/Thorough controls search effort with bounded deterministic sampling. A **Color grouping** control chooses the search targets: Layer-based merges colors sharing a printer layer; Color-based keeps hues separate within a bounded group budget while preserving every member’s original print layer. At least one group is retained per occupied layer, including visible regions with zero regional weight, so capped palettes keep every printable color assigned without changing scoring weights. Color-based can produce more printed colors, but does not guarantee lower color error. Fast fitted-optics simulation nominates a bounded shortlist; windows and final region paths are scored with the full appearance model and usage-weighted CIEDE2000 on the original grouped colors. Fully scored assignments are reused when their physical context is unchanged, avoiding repeated broad searches during reconciliation. The current order remains available during reconciliation, and calibrated preview colors and the 0.25 minimum predicted gain gate are retained. Head count, search depth, color grouping, and the mode toggle persist through fallback builds and retain edits made during analysis; Multi-head and Flat Paint are mutually exclusive. Worker errors, unusable or non-improving plans, and plans whose predicted usage-weighted mean CIEDE2000 gain over the normal stack is below 0.25 retain the normal single-head model, with a notice and its original start color and swaps. Instructions follow the built snapshot, and before the first multi-head build **Copy** gives the same build prompt the panel shows, not single-head swaps; fallback builds copy their single-head plan. Image changes cancel pending analysis and discard obsolete builds. Controls, notices, schedules, copied text, and usage guides are localized into all 12 languages. Added region/filament routing, head/extruder, pause, smoothing/topology, fallback, predicted gain, async lifecycle, worker failure, browser settings-persistence, and 3MF-only download menu regression coverage. Color-group regressions cover capped palettes crossing physical layer boundaries, and calibrated image measurements use final-stack surfaces with CIEDE2000. Added full-model shortlist, proof-anchor, weighted reconciliation, seeded corrected multi-window routing, and bounded-evaluation regressions plus reproducible measured-profile cats/Rocco benchmarks; removed unused LUT analyzers and test-only assignment bookkeeping.

- **Multi-head filament requirements** - Head schedules use final per-color paths only on layers those regions can print, avoiding reloads for abandoned filaments and unprinted suffixes while retaining zero-weight visible regions, useful preloads, and idle-head carryover. Height dithering resolves the actual filtered pixels on the preview's cropped block grid in the analysis worker; routing validation retains those printed surface limits. Added deterministic unused-load, active-layer head coverage, shared-block dithering, cropped-pixel scheduling, swap-count, copied-instruction, and physical 3MF regression coverage.
- **Awards page and Snapmaker Innovation Fund winner badge** - A new Awards page shows Kromacut's Snapmaker Innovation Fund Winner medal, linked to the Snapmaker Innovation Fund page. It is available in all 12 languages, prerendered for search engines, and listed in the sitemap. The website footer and the Settings links open it; the desktop app opens it in the system browser. The website and the README each gain an Awards section near the bottom. The badges embed Snapmaker's official logo files unaltered. A maintenance script regenerates the badge SVGs and the PNGs rendered from them; pages show the PNGs because Safari and other WebKit views draw the SVG lettering at the wrong font weight. Added route, static-page, Settings-link, and landing browser coverage. Privacy and Terms browser tests now account for all eight footer links, with the Privacy suite checking keyboard focus from Support through Awards to Privacy, restoring both suites after the Awards link was added.
Expand Down
5 changes: 4 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@ function App(): React.ReactElement | null {
() => getMultiHeadRoutingPlan(builtModelState),
[builtModelState]
);
// Both models are built from parts that only 3MF keeps apart.
const builtModelStlUnavailable = builtFlatPaint || builtMultiHeadPlan !== undefined;

const prevModeRef = useRef<typeof mode>(mode);

Expand Down Expand Up @@ -697,6 +699,7 @@ function App(): React.ReactElement | null {
setExportStep,
exportingSTL,
threeDBuildBusy,
stlUnavailable: builtModelStlUnavailable,
exportObjectToStlBlob,
exportObjectTo3MFBlob: (obj, onProgress, onZipProgress) =>
exportObjectTo3MFBlob(obj, {
Expand Down Expand Up @@ -1141,7 +1144,7 @@ function App(): React.ReactElement | null {
: undefined
}
downloadMenuButtonRef={downloadMenuButtonRef}
flatPaintModel={builtFlatPaint}
stlUnavailable={builtModelStlUnavailable}
modelExportDisabled={!builtModelValid || threeDBuildBusy}
inert={mode === '3d' && threeDBuildBusy}
isOrtho={isOrtho}
Expand Down
12 changes: 6 additions & 6 deletions src/components/PreviewActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ export interface PreviewActionsProps {
onChooseSlicer?: () => void;
/** Receives the download menu button, so the slicer chooser can return focus to it. */
downloadMenuButtonRef?: React.Ref<HTMLButtonElement>;
/** The currently built model is a Flat Paint slab — STL export is useless for it */
flatPaintModel?: boolean;
/** The built model is a Flat Paint slab or a multi-head build, so STL can't represent it. */
stlUnavailable?: boolean;
/** No valid model exists for the selected 3D mode/settings, or a build is running. */
modelExportDisabled?: boolean;
/** Covered by a build overlay: keep keyboard and screen-reader users out as well. */
Expand Down Expand Up @@ -117,7 +117,7 @@ export const PreviewActions: React.FC<PreviewActionsProps> = ({
savedSlicerName,
onChooseSlicer,
downloadMenuButtonRef,
flatPaintModel = false,
stlUnavailable = false,
modelExportDisabled = false,
inert = false,
isOrtho = false,
Expand Down Expand Up @@ -453,9 +453,9 @@ export const PreviewActions: React.FC<PreviewActionsProps> = ({
</Button>
</PopoverTrigger>
<PopoverContent align="end" className="w-auto min-w-48 p-1 flex flex-col gap-1">
{/* Flat Paint slabs carry their colors as per-filament 3MF
objects; a single-geometry STL of the slab is useless */}
{!flatPaintModel && (
{/* Flat Paint slabs and multi-head builds need 3MF: one STL
can't carry their per-filament objects or head routing */}
{!stlUnavailable && (
<Button
variant="ghost"
onClick={onExportStl}
Expand Down
3 changes: 3 additions & 0 deletions src/components/ThreeDView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,9 @@ export default function ThreeDView({
);
}

// The STL export checks the mesh itself, because a newer build
// snapshot can be committed before this one is replaced.
modelGroup.userData.kromacutStlUnavailable = flatPaint || !!multiHeadPlan;
try {
(
window as unknown as { __KROMACUT_LAST_MESH?: THREE.Object3D }
Expand Down
2 changes: 2 additions & 0 deletions src/docs/generating-exporting-output.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ STL does not carry filament colors or automatic spool assignments. Use the copie

For **Flat Paint** models the download menu offers only 3MF: the model contains one object per physical filament and, in the default face-down layout, a transparent carrier object. The optional face-up layout omits that carrier. An uncolored single-geometry STL of either flat slab would be useless. Both orientations support every **Smooth Meshing** strength. Rebuild after changing the strength to apply it to the preview and exported geometry.

Successful **Multi-head** builds also offer only 3MF, because STL can't carry their head assignments. A build that falls back to a normal single-head model still offers STL.

## Print Instructions

The **Print Instructions** panel gives you:
Expand Down
2 changes: 1 addition & 1 deletion src/docs/multi-head-printing.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ After a successful build, the preview shows each region's routed, simulated colo

- Before printing, load each listed filament into its numbered head. Leave **EMPTY** heads unused.
- At each listed layer checkpoint, reload only the marked heads. Unchanged loads are retained; not every window boundary needs a pause.
- Export **3MF** to preserve routed geometry, physical filament colors, and head assignments. The file records the selected head count as extruders and adds **M600** pause markers at the schedule's swap checkpoints. STL does not preserve these assignments.
- Export **3MF** to preserve routed geometry, physical filament colors, and head assignments. The file records the selected head count as extruders and adds **M600** pause markers at the schedule's swap checkpoints. The download menu offers only 3MF for multi-head builds, because STL can't carry these assignments.

![Three heads retain unchanged filaments between phases; only changed head loads require manual reloads.](02_nozzle_swap_schedule.svg)

Expand Down
18 changes: 16 additions & 2 deletions src/hooks/useAppHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export interface UseAppHandlersParams {
exportingSTL: boolean;
/** A 3D build is starting or running, so the exported mesh may not match its settings. */
threeDBuildBusy: boolean;
/** Flat Paint and multi-head models only export correctly as 3MF. */
stlUnavailable?: boolean;
exportObjectToStlBlob: (
object: THREE.Object3D,
onProgress?: (p: number) => void
Expand Down Expand Up @@ -117,6 +119,7 @@ export function useAppHandlers(params: UseAppHandlersParams) {
setExportStep,
exportingSTL,
threeDBuildBusy,
stlUnavailable = false,
exportObjectToStlBlob,
exportObjectTo3MFBlob,
applyQuantize,
Expand All @@ -143,11 +146,16 @@ export function useAppHandlers(params: UseAppHandlersParams) {
}, [canvasPreviewRef]);

const onExportStl = useCallback(async () => {
if (exportingSTL) return;
if (exportingSTL || stlUnavailable) return;
interface KromacutWindow extends Window {
__KROMACUT_LAST_MESH?: THREE.Object3D;
}
const threeObject = (window as KromacutWindow).__KROMACUT_LAST_MESH;
// A Flat Paint or multi-head mesh can outlive its build snapshot briefly.
const readStlMesh = () => {
const mesh = (window as KromacutWindow).__KROMACUT_LAST_MESH;
return mesh && !mesh.userData.kromacutStlUnavailable ? mesh : undefined;
};
const threeObject = readStlMesh();
if (!threeObject || threeDBuildBusy) {
alert(translate('messages:files.modelNotReady'));
return;
Expand All @@ -164,6 +172,11 @@ export function useAppHandlers(params: UseAppHandlersParams) {
const overlayStartedAt = performance.now();
try {
await waitForOverlayPaint();
// A build may have replaced the mesh while the overlay painted.
if (readStlMesh() !== threeObject) {
alert(translate('messages:files.modelNotReady'));
return;
}
const blob = await exportObjectToStlBlob(
threeObject,
createExportProgressReporter(setExportProgress, (progress) => {
Expand Down Expand Up @@ -203,6 +216,7 @@ export function useAppHandlers(params: UseAppHandlersParams) {
}, [
exportingSTL,
threeDBuildBusy,
stlUnavailable,
exportObjectToStlBlob,
setExportingSTL,
setExportProgress,
Expand Down
Loading
Loading