by adom
Altium molecule path: native STEP export (headless altium_export_step) and the full fabrication bundle (<slug>-fab.zip, export.json), handed with the .PcbDoc to molecule-publish. The wiki's model registry reads the .PcbDoc with the STEP and builds a full molecule: model, footprint and symbol. Includes make_overlay.py for local overlay previews.
← Commit history
SKILL.md+1@@ -272,6 +272,7 @@ Use the bundled script — it handles the alignment and the gerbv quirks: ```bash python3 make_overlay.py --gerber-dir gerber --out overlay_top.png --dpi 600 # board rect 0.0000,0.0000 -> 7.0866,1.9882 in (180.00 x 50.50 mm)+# drills: 172 hits, 172 punched through the overlay # copper 75.9% openings 10.5% pads 8.1% silk 7.2% ```
make_overlay.py+61@@ -29,6 +29,42 @@ SILK_RGB = (245, 245, 240) # slightly warm white, matches real silkscreen ink COORD = re.compile(rb'X(-?\d+)Y(-?\d+)') +def drill_hits(path: Path):+ """Parse an Excellon drill file -> [(x_mm, y_mm, dia_mm), ...].++ Needed because the board geometry has real holes but this overlay is a flat decal laid on+ top of it: without punching the holes out of the artwork, a mounting hole renders as a solid+ gold disc sitting over the hole. Assumes Altium's METRIC / LZ / FILE_FORMAT=4:4 header,+ which is what its NC Drill output emits.+ """+ if not path.exists():+ return []+ text = path.read_text(errors='replace')+ if 'METRIC' not in text:+ print(f' warning: {path.name} is not METRIC; skipping drill subtraction')+ return []++ def coord(v):+ neg = v.startswith('-')+ v = v.lstrip('-').ljust(8, '0') # 4 integer + 4 decimal digits+ val = int(v[:4]) + int(v[4:]) / 10000.0+ return -val if neg else val++ tools, cur, hits = {}, None, []+ for line in text.splitlines():+ line = line.strip()+ m = re.match(r'^T(\d+)F\d+S\d+C([\d.]+)', line)+ if m:+ tools[m.group(1)] = float(m.group(2)); continue+ m = re.match(r'^T(\d+)$', line)+ if m:+ cur = m.group(1); continue+ m = re.match(r'^X(-?\d+)Y(-?\d+)$', line)+ if m and cur:+ hits.append((coord(m.group(1)), coord(m.group(2)), tools.get(cur, 0.0)))+ return hits++ def board_rect_inches(gm1: Path): """Board outline rect from the Unit PCB Boundary layer (%FSLAX25Y25% -> 5 decimals). @@ -93,6 +129,31 @@ def main(): rgba[..., i] = rgba[..., i] * (1 - silk) + c * silk rgba[..., 3] = np.maximum(rgba[..., 3], silk) + # Punch the drilled holes out of the artwork. The STEP already contains real holes, so any+ # opaque pixel over a hole is a lie -- it hides the geometry underneath.+ hits = drill_hits(g / 'board.drl')+ if hits:+ px_per_mm = w / ((rect[2] - rect[0]) * 25.4)+ h_mm = (rect[3] - rect[1]) * 25.4+ yy, xx = np.mgrid[0:h, 0:w]+ punched = 0+ for x_mm, y_mm, dia in hits:+ if dia <= 0:+ continue+ cx = (x_mm - rect[0] * 25.4) * px_per_mm+ cy = (h_mm - (y_mm - rect[1] * 25.4)) * px_per_mm # image row 0 is max Y+ r = (dia / 2.0) * px_per_mm+ x0, x1 = max(0, int(cx - r - 2)), min(w, int(cx + r + 3))+ y0, y1 = max(0, int(cy - r - 2)), min(h, int(cy + r + 3))+ if x0 >= x1 or y0 >= y1:+ continue+ sub = ((xx[y0:y1, x0:x1] - cx) ** 2 + (yy[y0:y1, x0:x1] - cy) ** 2) <= r * r+ rgba[y0:y1, x0:x1, 3][sub] = 0.0+ punched += 1+ print(f' drills: {len(hits)} hits, {punched} punched through the overlay')+ else:+ print(' drills: none found (gerber/board.drl absent) -- holes will be covered by pad art')+ out = Image.fromarray( np.concatenate([rgba[..., :3], rgba[..., 3:4] * 255], axis=2).astype(np.uint8), 'RGBA') out.save(args.out)
package.json+1−1@@ -1,6 +1,6 @@ { "slug": "altium-export-molecule",- "version": "2.2.0",+ "version": "2.3.0", "type": "skill", "description": "Direct Altium -> OCCT molecule/board path: STEP export (bodies) + Gerber export (copper + silkscreen) -> composited top-face overlay -> step2glb molecule mode. Includes make_overlay.py. Hands off to molecule-publish.", "dependencies": {
page.json+1−1@@ -1,6 +1,6 @@ { "slug": "altium-export-molecule",- "version": "2.2.0",+ "version": "2.3.0", "type": "skill", "description": "Direct Altium -> OCCT molecule/board path: STEP export (bodies) + Gerber export (copper + silkscreen) -> composited top-face overlay -> step2glb molecule mode. Includes make_overlay.py. Hands off to molecule-publish.", "tags": [