11 lines
645 B
Plaintext
11 lines
645 B
Plaintext
import FreeCAD as A, Part, json, os
|
|
p=r'C:\projects\wheel\models\fan_direct_motor_side_140\Assembly.FCStd'
|
|
d=A.openDocument(p);d.recompute()
|
|
out={}
|
|
fan=d.getObject('DirectFan')
|
|
for name in ('Rail0','Rail1'):
|
|
a=d.getObject(name);out[name]={'fan_distance':a.Shape.distToShape(fan.Shape)[0],'fan_overlap':a.Shape.common(fan.Shape).Volume,'length':a.Shape.BoundBox.YLength}
|
|
assert all(abs(v['length']-140)<1e-6 and v['fan_distance']<1e-6 and abs(v['fan_overlap'])<1e-6 for v in out.values())
|
|
open(r'C:\projects\wheel\models\fan_direct_motor_side_140\contact_validation.json','w').write(json.dumps(out,indent=2))
|
|
A.closeDocument(d.Name);os._exit(0)
|