diff --git a/backend/app/domains/pipeline/tasks/export_glb.py b/backend/app/domains/pipeline/tasks/export_glb.py index 173563b..26f1353 100644 --- a/backend/app/domains/pipeline/tasks/export_glb.py +++ b/backend/app/domains/pipeline/tasks/export_glb.py @@ -283,20 +283,30 @@ def generate_gltf_production_task(self, cad_file_id: str, product_id: str | None "info", ) else: - # No usable cache: run tessellation from STEP + # No usable cache: run tessellation from STEP. + # When GMSH is selected, force preview-quality settings (0.1mm / 0.1rad) even here. + # Fine production settings (e.g. 0.03mm) combined with GMSH OOM-kill on large assemblies + # because CharacteristicLengthMax becomes too small. GMSH quality is algorithmic + # (conforming seams) not density-based — a denser GMSH mesh adds no UV-unwrap benefit. + if tessellation_engine == "gmsh": + eff_linear = float(sys_settings.get("gltf_preview_linear_deflection", "0.1")) + eff_angular = float(sys_settings.get("gltf_preview_angular_deflection", "0.1")) + else: + eff_linear = prod_linear + eff_angular = prod_angular occ_cmd = [ python_bin, str(occ_script), "--step_path", str(step_path), "--output_path", str(prod_geom_glb), - "--linear_deflection", str(prod_linear), - "--angular_deflection", str(prod_angular), + "--linear_deflection", str(eff_linear), + "--angular_deflection", str(eff_angular), "--sharp_threshold", str(sharp_threshold), "--tessellation_engine", tessellation_engine, ] log_task_event( self.request.id, - f"Tessellating STEP at production quality ({tessellation_engine}, " - f"linear={prod_linear}mm, angular={prod_angular}rad)", + f"Tessellating STEP for production ({tessellation_engine}, " + f"linear={eff_linear}mm, angular={eff_angular}rad)", "info", ) try: