feat: sharp edge pipeline V02, tessellation presets, media cache-bust, GMSH plan

Sharp Edge Pipeline V02:
- export_step_to_gltf.py: replace BRep_Tool.Polygon3D_s (returns None in XCAF) with
  GCPnts_UniformAbscissa curve sampling at 0.3mm step — extracts 17,129 segment pairs
- Inject sharp_edge_pairs + sharp_threshold_deg into GLB extras (scenes[0].extras)
  via binary GLB JSON-chunk patching (no extra dependency)
- export_gltf.py: read schaeffler_sharp_edge_pairs from Blender scene custom props,
  apply via KD-tree to mark edges sharp=True + seam=True (OCC mm Z-up → Blender transform)
- tools/restore_sharp_marks.py: dual-pass (dihedral angle + OCC pairs), updated coordinate
  transform (X, -Z, Y) * 0.001

Tessellation:
- Admin UI: Draft / Standard / Fine preset buttons with active-state highlighting
- Default angular deflection: preview 0.5→0.1 rad, production 0.2→0.05 rad
- export_glb.py: read updated defaults from system_settings

Media / Cache:
- media/service.py: get_download_url appends ?v={file_size_bytes} cache-buster
- media/router.py: Cache-Control: no-cache for all download/thumbnail endpoints

Render pipeline:
- still_render.py / turntable_render.py: shared GPU activation + camera improvements
- render_order_line.py: global render position support
- render_thumbnail.py: updated defaults

Frontend:
- InlineCadViewer: file_size_bytes-aware URL update triggers re-fetch on regeneration
- ThreeDViewer: material panel, part selection, PBR mode improvements
- Admin.tsx: tessellation preset cards, GMSH setting dropdown
- MediaBrowser, ProductDetail, OrderDetail, Orders: various UI improvements
- New: MaterialPanel, GlobalRenderPositionsPanel, StepIndicator components
- New: renderPositions.ts API client

Plans / Docs:
- plan.md: GMSH Frontal-Delaunay tessellation plan (6 tasks)
- LEARNINGS.md: OCC Polygon3D_s None issue + GCPnts fix
- .gitignore: add backend/core (core dump from root process)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 14:40:36 +01:00
parent 202b06a026
commit ca62319688
70 changed files with 6551 additions and 1130 deletions
+48
View File
@@ -98,8 +98,56 @@ export async function generateGltfProduction(cadFileId: string): Promise<Generat
return res.data
}
export interface ParsedObjectsResponse {
cad_file_id: string
original_name: string
processing_status: string
parsed_objects: {
dimensions_mm?: { x: number; y: number; z: number }
bbox_center_mm?: { x: number; y: number; z: number }
[key: string]: unknown
} | null
}
/** Return the parsed_objects metadata (dimensions, bbox) for a CAD file. */
export async function getParsedObjects(cadFileId: string): Promise<ParsedObjectsResponse> {
const res = await api.get<ParsedObjectsResponse>(`/cad/${cadFileId}/parsed-objects`)
return res.data
}
/** Force-reset a CAD file stuck in 'processing' to 'failed'. */
export async function resetStuckProcessing(cadFileId: string): Promise<{ status: string; message: string }> {
const res = await api.post<{ status: string; message: string }>(`/cad/${cadFileId}/reset-stuck`)
return res.data
}
// ---------------------------------------------------------------------------
// Part-material assignment
// ---------------------------------------------------------------------------
export interface PartMaterialEntry {
type: 'library' | 'hex'
value: string
}
export type PartMaterialMap = Record<string, PartMaterialEntry>
interface PartMaterialsResponse {
cad_file_id: string
part_materials: PartMaterialMap | null
}
/** Return the saved part-material assignments for a CAD file (empty object if none). */
export async function getPartMaterials(cadFileId: string): Promise<PartMaterialMap> {
const res = await api.get<PartMaterialsResponse>(`/cad/${cadFileId}/part-materials`)
return res.data.part_materials ?? {}
}
/** Replace the part-material assignment map for a CAD file. Returns the updated map. */
export async function savePartMaterials(
cadFileId: string,
map: PartMaterialMap,
): Promise<PartMaterialMap> {
const res = await api.put<PartMaterialsResponse>(`/cad/${cadFileId}/part-materials`, map)
return res.data.part_materials ?? {}
}
+9
View File
@@ -17,6 +17,7 @@ export interface MediaAssetFilters {
category_key?: string
render_status?: string
q?: string
exclude_technical?: boolean
page?: number
page_size?: number
}
@@ -34,6 +35,13 @@ export interface MediaAssetItem {
product_pim_id: string | null
category_key: string | null
render_status: string | null
// Extended product metadata
product_ebene1: string | null
product_ebene2: string | null
product_baureihe: string | null
product_produkt_baureihe: string | null
product_lagertyp: string | null
product_name_cad_modell: string | null
download_url: string | null
thumbnail_url: string | null
}
@@ -52,6 +60,7 @@ export function getMediaAssets(filters: MediaAssetFilters = {}): Promise<MediaAs
if (filters.category_key) params.set('category_key', filters.category_key)
if (filters.render_status) params.set('render_status', filters.render_status)
if (filters.q) params.set('q', filters.q)
if (filters.exclude_technical !== undefined) params.set('exclude_technical', String(filters.exclude_technical))
if (filters.page !== undefined) params.set('page', String(filters.page))
if (filters.page_size !== undefined) params.set('page_size', String(filters.page_size))
return api.get(`/media/assets?${params}`).then(r => r.data)
+36
View File
@@ -2,6 +2,38 @@ import api from './client'
import type { Product } from './products'
import type { OutputType } from './outputTypes'
export interface RenderLog {
renderer?: string
type?: string
format?: string
engine?: string
engine_used?: string
samples?: number
stl_quality?: string
smooth_angle?: number
total_duration_s?: number
stl_duration_s?: number
render_duration_s?: number
ffmpeg_duration_s?: number
stl_size_bytes?: number
output_size_bytes?: number
parts_count?: number
device_used?: string
compute_type?: string
gpu_fallback?: boolean
frame_count?: number
fps?: number
template?: string
lighting_only?: boolean
shadow_catcher?: boolean
material_replace?: boolean
fallback?: boolean
error?: string
started_at?: string
completed_at?: string
log_lines?: string[]
}
export interface OrderLine {
id: string
order_id: string
@@ -21,6 +53,9 @@ export interface OrderLine {
unit_price: number | null
render_position_id: string | null
render_position_name: string | null
render_log: RenderLog | null
render_started_at: string | null
render_completed_at: string | null
notes: string | null
created_at: string
updated_at: string
@@ -30,6 +65,7 @@ export interface OrderLineCreate {
product_id: string
output_type_id?: string | null
render_position_id?: string | null
global_render_position_id?: string | null
gewuenschte_bildnummer?: string | null
notes?: string | null
}
+5 -2
View File
@@ -1,5 +1,5 @@
import api from './client'
import type { Order } from './orders'
import type { Order, RenderLog } from './orders'
export interface RenderPosition {
id: string
@@ -62,9 +62,11 @@ export interface Product {
bbox_center_mm?: { x: number; y: number; z: number }
suggested_smooth_angle?: number
has_mechanical_edges?: boolean
sharp_edge_midpoints?: number[][]
sharp_edge_midpoints?: number[][] // legacy: midpoints only
sharp_edge_pairs?: number[][][] // [[start_xyz, end_xyz], ...] in mm
} | null
arbeitspaket: string | null
cad_render_log?: RenderLog | null
notes: string | null
is_active: boolean
source_excel: string | null
@@ -152,6 +154,7 @@ export interface ProductRender {
is_video: boolean
render_backend: string | null
completed_at: string | null
render_position_name: string | null
}
export async function getProductRenders(id: string): Promise<ProductRender[]> {
+50
View File
@@ -0,0 +1,50 @@
import api from './client'
export interface GlobalRenderPosition {
id: string
name: string
rotation_x: number
rotation_y: number
rotation_z: number
is_default: boolean
sort_order: number
created_at: string
updated_at: string
}
export interface GlobalRenderPositionCreate {
name: string
rotation_x?: number
rotation_y?: number
rotation_z?: number
is_default?: boolean
sort_order?: number
}
export interface GlobalRenderPositionPatch {
name?: string
rotation_x?: number
rotation_y?: number
rotation_z?: number
is_default?: boolean
sort_order?: number
}
export async function listGlobalRenderPositions(): Promise<GlobalRenderPosition[]> {
const res = await api.get<GlobalRenderPosition[]>('/render-positions/global')
return res.data
}
export async function createGlobalRenderPosition(body: GlobalRenderPositionCreate): Promise<GlobalRenderPosition> {
const res = await api.post<GlobalRenderPosition>('/render-positions/global', body)
return res.data
}
export async function updateGlobalRenderPosition(id: string, body: GlobalRenderPositionPatch): Promise<GlobalRenderPosition> {
const res = await api.patch<GlobalRenderPosition>(`/render-positions/global/${id}`, body)
return res.data
}
export async function deleteGlobalRenderPosition(id: string): Promise<void> {
await api.delete(`/render-positions/global/${id}`)
}