建立方向盘项目初始版本

This commit is contained in:
2026-10-29 22:04:55 +08:00
commit 9962cbfbce
834 changed files with 1519203 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
from pathlib import Path
import os,json,traceback
import FreeCAD as A, Part, Mesh
O=Path(r'C:\projects\wheel\models\fan120_integer_v2')
try:
d=A.openDocument(str(O/'Fan120Mount.FCStd'));d.recompute()
shape=d.getObject('FanMount').Shape
step=Part.read(str(O/'Fan120Mount.step'))
assert shape.isValid() and step.isValid() and len(shape.Solids)==len(step.Solids)==1
difference=[shape.cut(step).Volume,step.cut(shape).Volume]
(O/'verify_difference.json').write_text(json.dumps({'difference':difference,'volumes':[shape.Volume,step.Volume], 'shape_bounds':str(shape.BoundBox), 'step_bounds':str(step.BoundBox)},indent=2),encoding='utf8')
assert max(difference)<1e-4
mesh=Mesh.Mesh(str(O/'Fan120Mount.stl'));assert mesh.isSolid() and abs(mesh.BoundBox.ZMin)<1e-3
data=json.loads((O/'validation.json').read_text(encoding='utf8'))
data.update({'fcstd_reopened':True,'step_reopened':True,'step_fcstd_mutual_difference_mm3':[shape.cut(step).Volume,step.cut(shape).Volume]})
(O/'validation.json').write_text(json.dumps(data,indent=2),encoding='utf8')
A.closeDocument(d.Name);(O/'VERIFIED.txt').write_text('ok',encoding='utf8');os._exit(0)
except Exception:
(O/'VERIFY_ERROR.txt').write_text(traceback.format_exc(),encoding='utf8');os._exit(1)