InstaPCB
UnreviewedGenerate DFM (Design for Manufacturing) checks and InstaPCB quotes from `.kicad_pcb` files. Parses the board design, extracts specs, generates a 3D preview, and displays an interactive quote form in t
name: instapcb
description: Generate InstaPCB quotes and DFM checks from KiCad PCB designs. Use when the user asks for "InstaPCB quote", "PCB quote", "DFM check", "fabrication check", "can this board be manufactured", or has a .kicad_pcb file they want to fabricate.
InstaPCB Quote Generator
Generate DFM (Design for Manufacturing) checks and InstaPCB quotes from .kicad_pcb files. Parses the board design, extracts specs, generates a 3D preview, and displays an interactive quote form in the Gallia Viewer.
KiCad Service
All kicad-cli operations (GLB export, DRC) use the remote KiCad CLI service — KiCad is NOT installed locally in user containers. The service URL is configured via the KICAD_API environment variable (default: http://127.0.0.1:8780).
API client: /home/adom/gallia/viewer/kicad-api-client.js
InstaPCB Capabilities
| Parameter | Offered |
|---|---|
| Board thickness | 1.6mm |
| Layer count | 1, 2, 4, 6 |
| Min trace width / spacing | 0.1mm |
| Min via drill | 0.2mm |
| Copper weight | 0.5 oz (0.0175mm) |
| Solder mask color | Green |
| PCBA (assembly) | Included by default |
| Turnaround | 4 hours (fab + assembly) |
Workflow
Step 1: Locate the .kicad_pcb file
Ask the user which .kicad_pcb file to quote, or search the project directory:
Glob pattern: **/*.kicad_pcb
Read the entire file content.
Step 2: Parse board specs
Extract these values from the S-expression format:
Board outline (XY dimensions)
Find all geometry on the Edge.Cuts layer — this defines the board shape:
(gr_rect (start X1 Y1) (end X2 Y2) ... (layer "Edge.Cuts"))— width = |X2 - X1|, height = |Y2 - Y1|(gr_line (start X1 Y1) (end X2 Y2) ... (layer "Edge.Cuts"))— collect all start/end points(gr_arc ... (layer "Edge.Cuts"))— collect arc endpoints
For gr_line/gr_arc collections, compute the bounding box from all coordinates:
- boardWidth = max(X) - min(X)
- boardHeight = max(Y) - min(Y)
Report dimensions in mm, rounded to 2 decimal places.
Board thickness
Found in the general section:
(general
(thickness 1.6)
)
Extract the thickness value in mm.
Copper layer count
In the (layers ...) section at the top of the file, count layers with type signal or power:
(layers
(0 "F.Cu" signal)
(31 "B.Cu" signal)
(1 "In1.Cu" signal)
(2 "In2.Cu" signal)
)
The count of copper layers determines the layer count (1, 2, 4, 6, etc.).
Minimum track width
Search for all (segment ...) entries and find the minimum width value:
(segment (start X Y) (end X Y) (width 0.25) (layer "F.Cu") (net N))
Also check (arc ...) track entries if present. Report in mm. If no segments exist, report null.
Minimum via size
Search for all (via ...) entries:
(via (at X Y) (size 0.6) (drill 0.3) (layers "F.Cu" "B.Cu") (net N))
Extract minimum size (outer diameter) and minimum drill values. Report in mm. If no vias exist, report null.
Solder mask color
Found in the stackup section if present:
(setup
(stackup
(layer "F.SilkS" (type "Top Silk Screen"))
(layer "F.Paste" (type "Top Solder Paste"))
(layer "F.Mask" (type "Top Solder Mask") (color "Green"))
Extract the color value. If no stackup section, default to null.
Copper thickness
Found in the stackup section:
(layer "F.Cu" (type "copper") (thickness 0.035))
0.035mm = 1oz, 0.0175mm = 0.5oz. If not specified, report null.
Component and net counts
- Count
(footprint ...)top-level entries for component count - Count
(net N "name")entries in the(net ...)section for net count
Step 3: Generate 3D GLB preview
Export a 3D model of the board via the remote KiCad service:
import { boardExportGlb } from '/home/adom/gallia/viewer/kicad-api-client.js';
try {
await boardExportGlb('/path/to/board.kicad_pcb', '/tmp/instapcb-board.glb');
} catch (err) {
console.warn('GLB export failed, continuing without 3D preview:', err.message);
}
The service exports the full board (tracks, pads, zones, silkscreen, soldermask) and applies Y-up → Z-up conversion server-side. If the service fails (missing 3D models, etc.), continue without the GLB — the quote form will show specs without the 3D preview.
Step 4: Send to Gallia Viewer
POST the extracted specs and GLB path to the GV internal API:
curl -s -X POST http://127.0.0.1:8771 \
-H 'Content-Type: application/json' \
-d '{
"action": "show_instapcb",
"specs": {
"boardName": "MyBoard",
"boardWidth": 50.0,
"boardHeight": 30.0,
"boardThickness": 1.6,
"layerCount": 2,
"minTrackWidth": 0.25,
"minViaSize": 0.6,
"minViaDrill": 0.3,
"copperThickness": 0.035,
"solderMaskColor": "Green",
"componentCount": 12,
"netCount": 24
},
"glbPath": "/tmp/instapcb-board.glb"
}'
Specs JSON fields:
| Field | Type | Description |
|---|---|---|
boardName |
string | Board name (from filename, without extension) |
boardWidth |
number | Board width in mm |
boardHeight |
number | Board height in mm |
boardThickness |
number | Board thickness in mm |
layerCount |
number | Number of copper layers |
minTrackWidth |
number or null | Minimum track width in mm |
minViaSize |
number or null | Minimum via outer diameter in mm |
minViaDrill |
number or null | Minimum via drill diameter in mm |
copperThickness |
number or null | Copper thickness in mm |
solderMaskColor |
string or null | Solder mask color (e.g. "Green") |
componentCount |
number or null | Number of footprint instances |
netCount |
number or null | Number of nets |
Omit glbPath if the GLB export failed.
Step 5: Report results to user
After sending to GV, summarize the DFM check results:
- Board size: W x H mm
- Layers: N (supported/not supported)
- Thickness: X mm (1.6mm offered)
- Min trace: X mm (0.1mm minimum)
- Min via drill: X mm (0.2mm minimum)
- Solder mask: color (green only)
- Components: N (PCBA included)
Flag any specs that fall outside InstaPCB capabilities. If everything passes, tell the user the board is compatible with InstaPCB.
About InstaPCB
InstaPCB is Adom's on-site PCB fabrication and assembly service. Key facts:
- Single-board ordering — order just 1 PCB. No minimum quantity. This is a massive advantage for prototyping: iterate on a single board, test it, tweak, reorder. Traditional fabs force you to order 5+ boards minimum. Default the quote to qty 1.
- 4-hour turnaround for fully assembled PCBs at JLCPCB-like pricing
- UV fiber laser process eliminates most wet chemistry from traditional PCB fabrication
- Only possible because of proximity to Mouser Electronics (world's largest chip distributor, also in Fort Worth/DFW) — drone delivery means components arrive fast enough for same-day assembly
- Industry standard is ~2 weeks for assembled boards from China — InstaPCB compresses that to 4 hours
- Assembled boards go straight to the subscriber's cloud workcell for immediate testing
- Available as an amenity to cloud workcell subscribers
Troubleshooting
- KiCad service unreachable: Check that the KiCad CLI service is running. Verify with
curl http://$KICAD_API/health(default:http://127.0.0.1:8780/health). - GLB export fails: Often due to missing 3D model files referenced in footprints. This is non-critical — send specs to GV without the GLB path and the quote form will display without 3D preview.
- No Edge.Cuts geometry: Some board files may not have a defined outline. Report board dimensions as "unknown" and warn the user.
- No segments or vias: Simple boards may have no tracks (only copper fills/zones). Report min track width and via size as null — the quote form handles this gracefully.
- GV not responding: Check that the Gallia Viewer server is running on port 8770/8771. Restart with:
pkill -f 'node.*viewer/server.js' && node /home/adom/gallia/viewer/server.js &