feat(D): OCC mesh attribute extraction + Blender smooth shading integration

Migration 039: cad_files.mesh_attributes JSONB column.
domains/products/tasks.py: extract_mesh_attributes Celery task using pythonOCC.
still_render.py + turntable_render.py: _apply_mesh_attributes() sets auto-smooth
based on curved_ratio and topology threshold from OCC analysis.
render_blender.py: passes --mesh-attributes JSON arg to Blender subprocess.
render_still_task: loads mesh_attributes from DB and passes to renderer.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 17:07:55 +01:00
parent 7e47e4aca7
commit 716451ff76
8 changed files with 207 additions and 1 deletions
+5 -1
View File
@@ -180,6 +180,7 @@ def render_still(
denoising_prefilter: str = "",
denoising_quality: str = "",
denoising_use_gpu: str = "",
mesh_attributes: dict | None = None,
) -> dict:
"""Convert STEP → STL (cadquery) → PNG (Blender subprocess).
@@ -238,7 +239,7 @@ def render_still(
env["EGL_PLATFORM"] = "surfaceless"
def _build_cmd(eng: str) -> list:
return [
cmd = [
blender_bin,
"--background",
"--python", str(script_path),
@@ -261,6 +262,9 @@ def render_still(
denoising_input_passes or "", denoising_prefilter or "",
denoising_quality or "", denoising_use_gpu or "",
]
if mesh_attributes:
cmd += ["--mesh-attributes", json.dumps(mesh_attributes)]
return cmd
def _run(eng: str) -> subprocess.CompletedProcess:
proc = subprocess.Popen(