19 lines
1.2 KiB
Plaintext
19 lines
1.2 KiB
Plaintext
from pathlib import Path
|
|
import os, traceback
|
|
import FreeCAD as A, Import
|
|
O=Path(r'C:\projects\wheel\models\kfl_3030_concept')
|
|
try:
|
|
d=A.openDocument(str(O/'Assembly.FCStd'));d.recompute()
|
|
names=['CompactPlate0','CompactPlate1','Crossbeam0','Crossbeam1','NewRail0','NewRail1']+['PurchasedAngle%d%d'%(i,j) for i in range(2) for j in range(2)]+['BaseJoint%d%d'%(i,j) for i in range(2) for j in range(2)]
|
|
rows=[]
|
|
for n in names:
|
|
o=d.getObject(n); rows.append('%s: valid=%s volume=%.4f bounding=%s'%(n,o.Shape.isValid(),o.Shape.Volume,str(o.Shape.BoundBox)))
|
|
assert all(d.getObject(n) and d.getObject(n).Shape.isValid() and d.getObject(n).Shape.Volume>0 for n in names)
|
|
A.closeDocument(d.Name)
|
|
s=A.newDocument('STEPVerify');Import.insert(str(O/'Assembly.step'),s.Name);s.recompute()
|
|
rows.append('STEP imported objects: %d'%len([o for o in s.Objects if hasattr(o,'Shape') and not o.Shape.isNull()]))
|
|
assert len([o for o in s.Objects if hasattr(o,'Shape') and not o.Shape.isNull()])>10
|
|
(O/'verification.txt').write_text('\n'.join(rows),encoding='utf8');A.closeDocument(s.Name);os._exit(0)
|
|
except Exception:
|
|
(O/'verification_ERROR.txt').write_text(traceback.format_exc(),encoding='utf8');os._exit(1)
|