Skip to content

Commit 6fa915d

Browse files
authored
Add files via upload
1 parent e2428ea commit 6fa915d

3 files changed

Lines changed: 62 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Version 0.7 scripts
2+
3+
- `validate_educational_gcode.py` performs conservative text-level checks on the teaching G-code.
4+
- `validate_v0_7_package.py` validates required files, mesh quality, operation count and Python syntax.
5+
- The complete release was generated by `build_asterion_v0_7.py`, retained at repository root for reproducibility.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from __future__ import annotations
2+
import json, re
3+
from pathlib import Path
4+
ROOT=Path(__file__).resolve().parents[3]
5+
GC=ROOT/'cam/nx_cam/v0_7/educational_gcode'
6+
results=[]
7+
for p in sorted(GC.glob('*.nc')):
8+
text=p.read_text(errors='ignore').upper().splitlines()
9+
issues=[]; z=999.0; safe=5.0; has_m30=False
10+
for n,line in enumerate(text,1):
11+
if 'M30' in line: has_m30=True
12+
rapid=('G0 ' in line or line.strip().startswith('G0'))
13+
mz=re.search(r'Z(-?\d+(?:\.\d+)?)',line)
14+
if mz: z=float(mz.group(1))
15+
if rapid and z < safe:
16+
issues.append(f'line {n}: rapid move below {safe} mm clearance')
17+
ms=re.search(r'S(\d+)',line)
18+
if ms and int(ms.group(1))>20000:
19+
issues.append(f'line {n}: spindle speed above 20000 rpm')
20+
mf=re.search(r'F(\d+(?:\.\d+)?)',line)
21+
if mf and float(mf.group(1))>5000:
22+
issues.append(f'line {n}: feed above 5000 mm/min')
23+
if any(code in line for code in ['G53','G28','M98','M99']):
24+
issues.append(f'line {n}: machine-coordinate or subprogram code requires manual review')
25+
if not has_m30: issues.append('missing M30')
26+
results.append({'file':p.name,'status':'PASS' if not issues else 'REVIEW','issues':issues})
27+
print(json.dumps(results,indent=2))
28+
if any(r['status']!='PASS' for r in results): raise SystemExit(2)
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
from __future__ import annotations
2+
import csv, json, py_compile
3+
from pathlib import Path
4+
import trimesh
5+
ROOT=Path(__file__).resolve().parents[3]
6+
required=[
7+
'VERSION','calculations/v0_7/V0_7_manufacturing_screening_report.md',
8+
'cam/nx_cam/v0_7/tool_library.csv','cam/nx_cam/v0_7/operation_plan.csv',
9+
'cam/nx_cam/v0_7/inspection_plan.csv','cam/nx_cam/v0_7/NX_CAM_V0_7_Workflow.md',
10+
'prototype/v0_7/stl/asterion_full_vehicle_1_to_50.stl']
11+
errors=[]
12+
for r in required:
13+
if not (ROOT/r).exists(): errors.append('missing '+r)
14+
if (ROOT/'VERSION').read_text().strip()!='0.7.0': errors.append('wrong version')
15+
parts=list((ROOT/'cad/manufacturing_parts/v0_7/neutral').glob('*.stl'))
16+
if len(parts)!=4: errors.append(f'expected 4 part STL files, found {len(parts)}')
17+
for p in parts:
18+
m=trimesh.load_mesh(p)
19+
if len(m.faces)<100: errors.append(f'{p.name}: mesh too coarse')
20+
if not m.is_watertight: errors.append(f'{p.name}: not watertight')
21+
with (ROOT/'cam/nx_cam/v0_7/operation_plan.csv').open() as f:
22+
ops=list(csv.DictReader(f))
23+
if len(ops)<12: errors.append('operation plan too short')
24+
for p in (ROOT/'scripts/python/v0_7').glob('*.py'):
25+
py_compile.compile(str(p),doraise=True)
26+
report={'status':'PASS' if not errors else 'FAIL','errors':errors,'part_stl_count':len(parts),'operation_count':len(ops)}
27+
(ROOT/'calculations/v0_7/v0_7_validation_report.json').write_text(json.dumps(report,indent=2))
28+
print(json.dumps(report,indent=2))
29+
if errors: raise SystemExit(1)

0 commit comments

Comments
 (0)