cfccdd5397
Extract volume, surface area, part count, assembly hierarchy, and complexity from STEP files via OCC B-rep analysis. Backend: - extract_rich_metadata() in step_processor.py: computes per-part volume (BRepGProp), surface area, triangle/vertex count, assembly depth, instance count, complexity score, largest part identification - cad_metadata JSONB column on Product model (DB migration) - Auto-populated during STEP processing (non-fatal, 10s timeout) - Also stored in cad_files.mesh_attributes["rich_metadata"] - Batch re-extract endpoint: POST /admin/settings/reextract-rich-metadata AI Agent: - search_products returns part_count, volume_cm3, complexity, largest_part - query_database tool description documents cad_metadata schema Frontend: - ProductDetail page: CAD Metadata section with stat cards (parts, volume, surface area, complexity, triangles, assembly depth) - Admin System Tools: "Re-extract Rich Metadata" button for backfill Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
92 lines
2.6 KiB
Python
92 lines
2.6 KiB
Python
import uuid
|
|
from datetime import datetime
|
|
from typing import Literal
|
|
from pydantic import BaseModel
|
|
from app.domains.rendering.schemas import RenderPositionOut
|
|
|
|
|
|
class ProductCreate(BaseModel):
|
|
pim_id: str
|
|
name: str | None = None
|
|
category_key: str | None = None
|
|
ebene1: str | None = None
|
|
ebene2: str | None = None
|
|
baureihe: str | None = None
|
|
produkt_baureihe: str | None = None
|
|
lagertyp: str | None = None
|
|
name_cad_modell: str | None = None
|
|
gewuenschte_bildnummer: str | None = None
|
|
medias_rendering: bool | None = None
|
|
components: list[dict] = []
|
|
cad_part_materials: list[dict] = []
|
|
notes: str | None = None
|
|
is_active: bool = True
|
|
source_excel: str | None = None
|
|
|
|
|
|
class ProductPatch(BaseModel):
|
|
name: str | None = None
|
|
category_key: str | None = None
|
|
ebene1: str | None = None
|
|
ebene2: str | None = None
|
|
baureihe: str | None = None
|
|
produkt_baureihe: str | None = None
|
|
lagertyp: str | None = None
|
|
name_cad_modell: str | None = None
|
|
gewuenschte_bildnummer: str | None = None
|
|
medias_rendering: bool | None = None
|
|
components: list[dict] | None = None
|
|
cad_part_materials: list[dict] | None = None
|
|
notes: str | None = None
|
|
is_active: bool | None = None
|
|
|
|
|
|
class ProductOut(BaseModel):
|
|
id: uuid.UUID
|
|
pim_id: str
|
|
name: str | None
|
|
category_key: str | None
|
|
ebene1: str | None
|
|
ebene2: str | None
|
|
baureihe: str | None
|
|
produkt_baureihe: str | None
|
|
lagertyp: str | None
|
|
name_cad_modell: str | None
|
|
gewuenschte_bildnummer: str | None
|
|
medias_rendering: bool | None
|
|
components: list[dict]
|
|
cad_part_materials: list[dict]
|
|
cad_file_id: uuid.UUID | None
|
|
thumbnail_url: str | None = None
|
|
render_image_url: str | None = None
|
|
processing_status: str | None = None
|
|
cad_parsed_objects: list[str] | None = None
|
|
cad_mesh_attributes: dict | None = None
|
|
arbeitspaket: str | None = None
|
|
cad_render_log: dict | None = None
|
|
cad_metadata: dict | None = None
|
|
notes: str | None
|
|
is_active: bool
|
|
source_excel: str | None
|
|
render_positions: list[RenderPositionOut] = []
|
|
created_at: datetime
|
|
updated_at: datetime
|
|
|
|
model_config = {"from_attributes": True}
|
|
|
|
|
|
class PartEntry(BaseModel):
|
|
part_key: str
|
|
source_name: str
|
|
prim_path: str | None = None
|
|
effective_material: str | None
|
|
assignment_provenance: Literal["manual", "auto", "source", "default"]
|
|
is_unassigned: bool
|
|
|
|
|
|
class SceneManifest(BaseModel):
|
|
cad_file_id: str
|
|
parts: list[PartEntry]
|
|
unmatched_source_rows: list[str]
|
|
unassigned_parts: list[str]
|