Download ORCASat/ORCASat_CAD/source/release.py from 5PACE/5PACE3Dmodelsatellites: direct link, hf CLI and curl.
- Browser
- Download file 4.03 kB
-
https://huggingface.co/datasets/5PACE/5PACE3Dmodelsatellites/resolve/main/ORCASat/ORCASat_CAD/source/release.py
- Command line
-
hf download hf://datasets/5PACE/5PACE3Dmodelsatellites/ORCASat/ORCASat_CAD/source/release.py
-
curl -L -o release.py https://huggingface.co/datasets/5PACE/5PACE3Dmodelsatellites/resolve/main/ORCASat/ORCASat_CAD/source/release.py
4.03 kB
| #!/usr/bin/env python3 | |
| """Regenerate corrected CAD, all GLBs, previews and exchange validation.""" | |
| from pathlib import Path | |
| import json,time | |
| from collections import Counter | |
| from PIL import Image,ImageDraw,ImageFont | |
| import build_orcasat as b | |
| import build_compatibility as compatibility | |
| import export_glb,validate_release,check_fit | |
| def overview(out): | |
| canvas=Image.new('RGB',(2100,1260),'#f2f5f8');d=ImageDraw.Draw(canvas) | |
| font='/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf' | |
| title=ImageFont.truetype(font,48);small=ImageFont.truetype(font,25) | |
| d.text((55,28),'ORCASat | CAD v'+b.VERSION,font=title,fill='#172c43') | |
| d.text((55,95),'Reconstruction from supplied references + final assembly video',font=small,fill='#40566c') | |
| views=[('ORCASat_Stowed','Stowed'),('ORCASat_Internal','Internal'),('ORCASat_Exploded','Exploded'),('ORCASat_Zenith','Zenith / FSS'),('ORCASat_Deployed','Deployed'),('ORCASat_Bus','Bus / original antenna')] | |
| for i,(name,label) in enumerate(views): | |
| x=35+(i%3)*690;y=165+(i//3)*525 | |
| im=Image.open(out/'previews'/(name+'.png')).convert('RGB');im.thumbnail((640,450)) | |
| canvas.paste(im,(x+(660-im.width)//2,y));d.text((x+15,y+457),label,font=small,fill='#172c43') | |
| d.text((55,1220),'Reference model. Antenna source geometry retained; other detailed dimensions may be estimated.',font=ImageFont.truetype(font,20),fill='#40566c') | |
| canvas.save(out/'ORCASat_Overview.png') | |
| def main(): | |
| start=time.time();out=Path(__file__).resolve().parent.parent;target=out/'EXPORT' | |
| b.build();b.write_manifest(out) | |
| corrections=validate_release.correction_checks() | |
| fit=check_fit.check_fit(False) | |
| (out/'fit_checks.json').write_text(json.dumps(fit,indent=2)) | |
| assert not fit['failures'],fit['failures'] | |
| summary={'version':b.VERSION,'components_defined':len(b.PARTS),'solids_defined':sum(len(p.shape.Solids()) for p in b.PARTS),'components_stowed':sum(b.visible(p,'stowed','full') for p in b.PARTS),'solids_stowed':sum(len(p.shape.Solids()) for p in b.PARTS if b.visible(p,'stowed','full')),'components_by_module':dict(Counter(p.group for p in b.PARTS if b.visible(p,'stowed','full'))),'all_defined_shapes_valid':all(p.shape.isValid() for p in b.PARTS),'correction_checks':corrections,'targeted_fit_checks':{'pairs':fit['tested_pairs'],'failures':len(fit['failures'])}} | |
| assert summary['all_defined_shapes_valid'] | |
| (out/'build_summary.json').write_text(json.dumps(summary,indent=2)) | |
| b.export_steps(out);compatibility.export_all() | |
| manifest=export_glb.export_all(target) | |
| for name,state,view,cam in [('ORCASat_Stowed','stowed','full',(1.4,1.8,.65)),('ORCASat_Deployed','deployed','full',(1.4,1.8,.65)),('ORCASat_Internal','stowed','internal',(1.4,1.8,.65)),('ORCASat_Exploded','deployed','exploded',(1.5,1.8,.8)),('ORCASat_Zenith','stowed','full',(-1.2,-1.7,.8)),('ORCASat_Bus','stowed','bus',(1.4,1.8,.7))]: | |
| print('Rendering',name,flush=True);b.render(out/'previews'/(name+'.png'),state,view,cam,size=(1200,1400)) | |
| overview(out) | |
| steps=validate_release.validate_steps(out) | |
| glbs=validate_release.validate_glbs(target,manifest) | |
| report={'version':b.VERSION,'geometry':'All defined CAD shapes passed Open CASCADE shape validity checks during build.','corrections':corrections,'targeted_fit_checks':fit,'STEP':steps,'GLB':glbs,'SolidWorks_application_test':'Not run here; no SolidWorks runtime is available. User confirmed previous blank view was long loading.','dimensional_scope':'Reference reconstruction; unscaled original source antenna geometry, other placements and most details estimated. Selected interfaces checked; no complete interference, tolerance, mass or flight-configuration qualification.','elapsed_seconds':round(time.time()-start,1)} | |
| (out/'validation_report.json').write_text(json.dumps(report,indent=2));(target/'validation_report.json').write_text(json.dumps(glbs,indent=2)) | |
| print('RELEASE PASS',json.dumps(summary),round(time.time()-start,1),'s',flush=True) | |
| if __name__=='__main__':main() | |