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
+83 -7
View File
@@ -42,7 +42,7 @@ export default function OrdersPage() {
const navigate = useNavigate()
const qc = useQueryClient()
const [view, setView] = useState<'kanban' | 'list'>('kanban')
const [view, setView] = useState<'kanban' | 'list'>(() => window.innerWidth < 768 ? 'list' : 'kanban')
const [searchInput, setSearchInput] = useState('')
const [debouncedSearch, setDebouncedSearch] = useState('')
const [selectedStatuses, setSelectedStatuses] = useState<Set<Status>>(new Set())
@@ -52,6 +52,13 @@ export default function OrdersPage() {
const [selected, setSelected] = useState<Set<string>>(new Set())
const [confirmState, setConfirmState] = useState<{ open: boolean; title: string; message: string; onConfirm: () => void }>({ open: false, title: '', message: '', onConfirm: () => {} })
// Auto-switch to list view on narrow screens
useEffect(() => {
const handler = () => { if (window.innerWidth < 768) setView('list') }
window.addEventListener('resize', handler)
return () => window.removeEventListener('resize', handler)
}, [])
// Debounce the search input (400 ms)
useEffect(() => {
const t = setTimeout(() => setDebouncedSearch(searchInput.trim()), 400)
@@ -163,10 +170,15 @@ export default function OrdersPage() {
const handleDeleteSelected = () => {
const ids = [...selected]
if (!ids.length) return
const ordersMap = Object.fromEntries(orders.map((o) => [o.id, o]))
const submittedCount = ids.filter((id) => ordersMap[id]?.status === 'submitted').length
const message = submittedCount > 0
? `⚠️ ${submittedCount} of ${ids.length} selected order${ids.length > 1 ? 's' : ''} ${submittedCount === 1 ? 'has' : 'have'} been submitted and may be processing. Delete anyway?`
: `Delete ${ids.length} order${ids.length > 1 ? 's' : ''}? This cannot be undone.`
setConfirmState({
open: true,
title: `Delete ${ids.length} order${ids.length > 1 ? 's' : ''}`,
message: 'This cannot be undone.',
message,
onConfirm: () => {
deleteMut.mutate(ids)
setConfirmState((s) => ({ ...s, open: false }))
@@ -323,10 +335,12 @@ export default function OrdersPage() {
</div>
{/* ── Content ──────────────────────────────────────────────────────── */}
{isLoading ? (
{isLoading && !isSearchMode && orders.length === 0 ? (
view === 'kanban' ? <KanbanSkeleton /> : <ListSkeleton />
) : isLoading && isSearchMode ? (
<div className="flex-1 flex items-center justify-center text-content-muted">
<Loader2 size={24} className="animate-spin mr-2" />
{isSearchMode ? 'Searching…' : 'Loading orders…'}
Searching
</div>
) : isSearchMode ? (
<SearchResultsView
@@ -370,9 +384,10 @@ export default function OrdersPage() {
{/* ── Bulk delete bar ───────────────────────────────────────────────── */}
{selected.size > 0 && (
<div className="fixed bottom-6 left-1/2 -translate-x-1/2 ml-[120px] z-50
flex items-center gap-3 px-5 py-3
bg-gray-900 text-white rounded-2xl shadow-2xl ring-1 ring-white/10">
<div
className="fixed bottom-6 z-50 flex items-center gap-3 px-5 py-3 bg-gray-900 text-white rounded-2xl shadow-2xl ring-1 ring-white/10"
style={{ left: 'calc(240px + (100vw - 240px) / 2)', transform: 'translateX(-50%)' }}
>
<span className="text-sm font-medium">
{selected.size} order{selected.size > 1 ? 's' : ''} selected
</span>
@@ -399,6 +414,67 @@ export default function OrdersPage() {
)
}
// ── Skeleton loaders ──────────────────────────────────────────────────────────
function ListSkeleton() {
return (
<div className="flex-1 overflow-y-auto">
<div className="mx-6 my-4 card overflow-hidden animate-pulse">
<div className="grid grid-cols-[2rem_1fr_6rem_5rem_6rem] bg-surface-alt border-b border-border-default px-4 py-2.5">
<div className="h-3 w-3 bg-surface-muted rounded" />
<div className="h-3 w-24 bg-surface-muted rounded" />
<div className="h-3 w-12 bg-surface-muted rounded" />
<div className="h-3 w-14 bg-surface-muted rounded" />
<div className="h-3 w-16 bg-surface-muted rounded" />
</div>
<div className="divide-y divide-border-light">
{Array.from({ length: 5 }, (_, i) => (
<div key={i} className="grid grid-cols-[2rem_1fr_6rem_5rem_6rem] items-center px-4 py-3 gap-x-4">
<div className="h-3.5 w-3.5 bg-surface-muted rounded" />
<div className="space-y-1.5">
<div className="h-3.5 w-32 bg-surface-muted rounded" />
<div className="h-2.5 w-48 bg-surface-muted rounded opacity-60" />
</div>
<div className="h-3 w-12 bg-surface-muted rounded" />
<div className="h-5 w-16 bg-surface-muted rounded-full" />
<div className="h-3 w-14 bg-surface-muted rounded" />
</div>
))}
</div>
</div>
</div>
)
}
function KanbanSkeleton() {
return (
<div className="flex-1 overflow-x-auto min-h-0">
<div className="flex gap-4 p-6 h-full">
{['bg-gray-400', 'bg-blue-400', 'bg-amber-400'].map((color, ci) => (
<div key={ci} className="flex flex-col w-72 min-w-[272px] animate-pulse">
<div className={`${color} rounded-t-xl px-4 py-3 flex items-center gap-2`}>
<div className="h-4 w-4 bg-white/40 rounded" />
<div className="h-3.5 w-20 bg-white/40 rounded" />
<div className="ml-auto h-5 w-6 bg-white/30 rounded-full" />
</div>
<div className="flex-1 bg-surface-muted rounded-b-xl p-2 space-y-2 min-h-[120px]">
{Array.from({ length: 2 }, (_, i) => (
<div key={i} className="bg-surface rounded-lg p-3 border border-border-default border-l-4 border-l-border-default">
<div className="h-3.5 w-24 bg-surface-muted rounded mb-2" />
<div className="flex gap-3">
<div className="h-3 w-16 bg-surface-muted rounded" />
<div className="h-3 w-20 bg-surface-muted rounded" />
</div>
</div>
))}
</div>
</div>
))}
</div>
</div>
)
}
// ── Search results view ───────────────────────────────────────────────────────
function SearchResultsView({