23 lines
1.1 KiB
Python
23 lines
1.1 KiB
Python
"""Consistent result labels for interactive and scripted entry points."""
|
|
from pathlib import Path
|
|
|
|
|
|
def result_status(report):
|
|
if report.get('modification_failed'):
|
|
return 'modification_failed'
|
|
return report.get('quality_status') or ('failed' if report.get('is_fallback_placeholder') else
|
|
'approximate' if report.get('degraded_fallback') else 'unverified')
|
|
|
|
|
|
def print_report(report):
|
|
status=result_status(report)
|
|
label={'passed':'分阶段核对通过','partial':'部分完成,仍需修复','failed':'生成失败',
|
|
'approximate':'降级近似','unverified':'已生成,尚未独立核对','modification_failed':'修改未生效'}.get(status,'待核对')
|
|
print(f"\n[{label}] 体积: {report['volume_mm3']:.2f} mm^3")
|
|
reason=report.get('modification_failed_reason') or report.get('quality_reason') or report.get('fallback_reason')
|
|
if reason: print(reason)
|
|
print(f"STEP: {report['step_file']}")
|
|
print(f"STL: {report['stl_file']}")
|
|
print(f"报告: {Path(report['step_file']).parent / 'report.json'}")
|
|
return 2 if status in ('partial','failed','modification_failed','approximate') else 0
|