Add STL thumbnail generation support

- Add trimesh and matplotlib dependencies for software-based 3D rendering
- Create stl_thumbnail service with generate_stl_thumbnail() function
- Handle mesh simplification for large files (>100k vertices)
- Auto-generate thumbnails during STL file upload and ZIP extraction
- Add POST /library/files/{id}/regenerate-thumbnail endpoint
- Add POST /library/generate-stl-thumbnails batch endpoint
- Add "Generate Thumbnails" button to file manager toolbar
- Add "Regenerate Thumbnail" option to file context menu
- Add unit and integration tests for new functionality

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
MisterBeardy
2026-01-29 15:06:01 +01:00
committed by MartinNYHC
co-authored by Claude Opus 4.5
parent 86ad13398a
commit 375d5238d0
9 changed files with 1020 additions and 2 deletions
+30
View File
@@ -2821,6 +2821,21 @@ export const api = {
used_meters: number;
}>;
}>(`/library/files/${fileId}/filament-requirements${plateId !== undefined ? `?plate_id=${plateId}` : ''}`),
// STL Thumbnail Generation
regenerateFileThumbnail: (fileId: number) =>
request<LibraryFile>(`/library/files/${fileId}/regenerate-thumbnail`, {
method: 'POST',
}),
batchGenerateStlThumbnails: (options: {
file_ids?: number[];
folder_id?: number;
all_missing?: boolean;
}) =>
request<BatchThumbnailResponse>('/library/generate-stl-thumbnails', {
method: 'POST',
body: JSON.stringify(options),
}),
};
// AMS History types
@@ -3045,6 +3060,21 @@ export interface ZipExtractResponse {
errors: ZipExtractError[];
}
// Batch Thumbnail Generation types
export interface BatchThumbnailResult {
file_id: number;
filename: string;
success: boolean;
error: string | null;
}
export interface BatchThumbnailResponse {
processed: number;
succeeded: number;
failed: number;
results: BatchThumbnailResult[];
}
// Library Queue types
export interface AddToQueueResult {
file_id: number;