Browse Source

Add printer model display to file cards for .3mf files

Co-authored-by: cadtoolbox <12723486+cadtoolbox@users.noreply.github.com>
copilot-swe-agent[bot] 3 months ago
parent
commit
4f54251189

+ 3 - 0
backend/app/api/routes/library.py

@@ -664,10 +664,12 @@ async def list_files(
         print_name = None
         print_name = None
         print_time = None
         print_time = None
         filament_grams = None
         filament_grams = None
+        sliced_for_model = None
         if f.file_metadata:
         if f.file_metadata:
             print_name = f.file_metadata.get("print_name")
             print_name = f.file_metadata.get("print_name")
             print_time = f.file_metadata.get("print_time_seconds")
             print_time = f.file_metadata.get("print_time_seconds")
             filament_grams = f.file_metadata.get("filament_used_grams")
             filament_grams = f.file_metadata.get("filament_used_grams")
+            sliced_for_model = f.file_metadata.get("sliced_for_model")
 
 
         file_list.append(
         file_list.append(
             FileListResponse(
             FileListResponse(
@@ -685,6 +687,7 @@ async def list_files(
                 print_name=print_name,
                 print_name=print_name,
                 print_time_seconds=print_time,
                 print_time_seconds=print_time,
                 filament_used_grams=filament_grams,
                 filament_used_grams=filament_grams,
+                sliced_for_model=sliced_for_model,
             )
             )
         )
         )
 
 

+ 1 - 0
backend/app/schemas/library.py

@@ -154,6 +154,7 @@ class FileListResponse(BaseModel):
     print_name: str | None = None
     print_name: str | None = None
     print_time_seconds: int | None = None
     print_time_seconds: int | None = None
     filament_used_grams: float | None = None
     filament_used_grams: float | None = None
+    sliced_for_model: str | None = None
 
 
     class Config:
     class Config:
         from_attributes = True
         from_attributes = True

+ 1 - 0
frontend/src/api/client.ts

@@ -3820,6 +3820,7 @@ export interface LibraryFileListItem {
   print_name: string | null;
   print_name: string | null;
   print_time_seconds: number | null;
   print_time_seconds: number | null;
   filament_used_grams: number | null;
   filament_used_grams: number | null;
+  sliced_for_model: string | null;
 }
 }
 
 
 export interface LibraryFileUpdate {
 export interface LibraryFileUpdate {

+ 6 - 0
frontend/src/pages/FileManagerPage.tsx

@@ -962,6 +962,12 @@ function FileCard({ file, isSelected, isMobile, onSelect, onDelete, onDownload,
             </span>
             </span>
           )}
           )}
         </div>
         </div>
+        {file.sliced_for_model && (
+          <div className="mt-1 text-xs text-purple-400 flex items-center gap-1">
+            <Printer className="w-3 h-3" />
+            {file.sliced_for_model}
+          </div>
+        )}
         {file.print_count > 0 && (
         {file.print_count > 0 && (
           <div className="mt-1 text-xs text-bambu-green">
           <div className="mt-1 text-xs text-bambu-green">
             {t('fileManager.printedCount', { count: file.print_count })}
             {t('fileManager.printedCount', { count: file.print_count })}