x
This commit is contained in:
+31
-6
@@ -440,6 +440,9 @@ def main():
|
||||
|
||||
stp_path = sys.argv[1]
|
||||
|
||||
# 检查是否跳过 PythonOCC 验证(默认跳过,因为主流程已用 PythonOCC 解析)
|
||||
skip_pythonocc = os.environ.get('SKIP_PYTHONOCC', 'true').lower() == 'true'
|
||||
|
||||
if not os.path.exists(stp_path):
|
||||
print(f"❌ 文件不存在: {stp_path}")
|
||||
sys.exit(1)
|
||||
@@ -452,20 +455,42 @@ def main():
|
||||
print(f"# STP文件几何验证报告")
|
||||
print(f"# 文件: {stp_path}")
|
||||
print(f"# 时间: {verification_result['timestamp']}")
|
||||
print(f"# PythonOCC验证: {'跳过' if skip_pythonocc else '启用'}")
|
||||
print(f"{'#'*70}")
|
||||
|
||||
# FreeCAD验证
|
||||
freecad_result = verify_with_freecad(stp_path)
|
||||
verification_result["freecad"] = freecad_result or {}
|
||||
|
||||
# PythonOCC验证
|
||||
pythonocc_result = verify_with_pythonocc(stp_path)
|
||||
verification_result["pythonocc"] = pythonocc_result or {}
|
||||
# PythonOCC验证(可选,默认跳过以节省时间)
|
||||
pythonocc_result = None
|
||||
if not skip_pythonocc:
|
||||
pythonocc_result = verify_with_pythonocc(stp_path)
|
||||
verification_result["pythonocc"] = pythonocc_result or {}
|
||||
else:
|
||||
print("\n⏩ 跳过 PythonOCC 验证(主流程已使用 PythonOCC 解析)")
|
||||
verification_result["pythonocc"] = {"skipped": True, "reason": "主流程已使用PythonOCC解析"}
|
||||
|
||||
# 对比结果
|
||||
comparison = compare_results(freecad_result, pythonocc_result)
|
||||
verification_result["comparison"] = comparison or {}
|
||||
verification_result["status"] = comparison.get('overall_status', 'failed') if comparison else 'failed'
|
||||
if pythonocc_result:
|
||||
comparison = compare_results(freecad_result, pythonocc_result)
|
||||
verification_result["comparison"] = comparison or {}
|
||||
verification_result["status"] = comparison.get('overall_status', 'failed') if comparison else 'failed'
|
||||
else:
|
||||
# 只有 FreeCAD 验证时,根据 FreeCAD 结果判断
|
||||
if freecad_result:
|
||||
verification_result["status"] = "passed"
|
||||
verification_result["comparison"] = {
|
||||
"note": "仅执行 FreeCAD 验证",
|
||||
"freecad_volume_cm3": freecad_result.get('volume_cm3'),
|
||||
"freecad_surface_area_cm2": freecad_result.get('surface_area_cm2')
|
||||
}
|
||||
print(f"\n{'='*70}")
|
||||
print(f"验证结果: ✅ 通过 (仅FreeCAD验证)")
|
||||
print(f"{'='*70}\n")
|
||||
else:
|
||||
verification_result["status"] = "failed"
|
||||
verification_result["comparison"] = {"note": "FreeCAD 验证失败"}
|
||||
|
||||
# 保存JSON报告
|
||||
report_path = Path(stp_path).stem + "_verification_report.json"
|
||||
|
||||
Reference in New Issue
Block a user