High-Level PCB Layout Tools
High-level PCB layout tools turn agent intent into previewable, constraint-checked layout operations before any PCB mutation is applied.
These tools sit above the primitive PCB operations such as component placement and track creation. They are intended for safer agent workflows where a plan must be reviewed before write operations run.
Tools
easyeda_pcb_place_component_group
easyeda_pcb_route_path_planBoth tools are high-risk write-capable tools, but they support a preview-first workflow:
mode: 'preview'creates a plan and does not call the EasyEDA bridge.mode: 'apply'applies the generated operations only whenconfirmWrite: trueis present.- Constraint errors block apply before any bridge call.
- Every output includes a transaction id, operations, issues, and a human-readable summary.
Component group placement
easyeda_pcb_place_component_group places multiple components on a grid starting from an anchor point.
It validates:
- board dimensions;
- component dimensions and references;
- board boundary fit;
- keepout overlap;
- spacing/collision risk.
Preview example:
{
"mode": "preview",
"board": { "widthMm": 60, "heightMm": 40 },
"anchor": { "x": 10, "y": 10 },
"columns": 2,
"spacingMm": 4,
"components": [
{ "ref": "U1", "primitiveId": "p-u1", "widthMm": 6, "heightMm": 6 },
{ "ref": "C1", "primitiveId": "p-c1", "widthMm": 2, "heightMm": 1.2 }
]
}Apply example:
{
"mode": "apply",
"confirmWrite": true,
"board": { "widthMm": 60, "heightMm": 40 },
"anchor": { "x": 10, "y": 10 },
"components": [{ "ref": "U1", "primitiveId": "p-u1", "widthMm": 6, "heightMm": 6 }]
}If a component would be outside the board or inside a keepout, the tool returns blocked: true and does not call the bridge.
Route path planning
easyeda_pcb_route_path_plan creates a constrained route path for one net from a waypoint list.
It validates:
- at least two waypoints;
- positive trace width;
- minimum trace width constraint;
- optional maximum path length;
- optional board boundary;
- optional keepout crossing.
Preview example:
{
"mode": "preview",
"netName": "GND",
"layer": 1,
"widthMm": 0.4,
"board": { "widthMm": 60, "heightMm": 40 },
"waypoints": [
{ "x": 5, "y": 5 },
{ "x": 15, "y": 5 },
{ "x": 15, "y": 15 }
]
}Apply example:
{
"mode": "apply",
"confirmWrite": true,
"netName": "GND",
"layer": 1,
"widthMm": 0.4,
"waypoints": [
{ "x": 0, "y": 0 },
{ "x": 10, "y": 0 }
]
}If a route leaves the board, crosses a keepout, or violates minimum width, apply is blocked before pcb.addTrack is called.
Output shape
Both tools return:
{
success: boolean;
project_id: string;
transaction_id: string;
mode: 'preview' | 'apply';
applied: boolean;
blocked: boolean;
operations: Array<{ method: string; params: Record<string, unknown> }>;
issues: Array<{
code: string;
severity: 'error' | 'warning' | 'info';
message: string;
remediationHint: string;
details?: Record<string, unknown>;
}>;
summary: string;
}Safety model
These tools follow the same safety policy as primitive PCB writes:
- Generate a previewable plan first.
- Review operations and issues.
- Apply only with
mode: 'apply'andconfirmWrite: true. - Run read-only DRC/ERC, production review, and export checks after applying.
The tools are intentionally conservative. When geometry is ambiguous, they prefer blocking the plan over applying potentially unsafe layout changes.
Floorplanning from CircuitIR
easyeda_pcb_floorplan (profile full) translates CircuitIR physical constraints into an easyeda_pcb_place_component_group-compatible plan, instead of the caller having to hand-build the grid itself. CircuitIR devices carry no physical footprint dimensions, so the caller must supply a widthMm/heightMm per device alongside the CircuitIR.
It reads:
- Keepouts —
circuitIR.pcb.keepoutAreas, approximated as axis-aligned bounding boxes (not the exact polygon). - Top/bottom side — a
physicalConstraintsentry oftype: 'placement'withpreferredSide: 'bottom'routes that device to a separate pass onbottomLayerinstead oftopLayer. - Connector edges — any device tagged with role
connector(seecomponent-planning.ts) is placed in its own pass hugging a chosen board edge (connectorEdge, defaultbottom) rather than the general grid. - Thermal spacing — a device at or above
thermalDissipationThresholdWatts(or with an explicittype: 'thermal'constraint) boosts the minimum spacing for its whole pass bythermalSpacingBoostMm.
Because top and bottom devices genuinely share the same board area on a real two-sided board, each pass is collision-checked independently — cross-side overlaps are not flagged. Every response's floorplan_notes field states this and any other simplification made for that specific plan, so nothing is silently assumed.
Autorouting
easyeda_pcb_autoroute (profile pro) drives EasyEDA Pro's native autorouter — PCB_Document.autoRouting, reached through the existing documented api.call path, not a new dedicated bridge method. This is a @beta EasyEDA Pro API per @jlceda/pro-api-types, so it may not be available in every EasyEDA Pro version; a failed call is reported as not_available: true, never a silent success.
The tool never returns success without evidence:
- Pre-flight —
validatePcbConstraintsruns first; any error blocks the call before the bridge is touched (blocked_by_preflight: true). - Autoroute — calls
PCB_Document.autoRoutingwith the requested nets/corner-style/optimization/existing-primitive-mode, translated to the exact numeric enum values EasyEDA Pro's runtime expects. - Post-route (mandatory) — runs
design.drcand a freshvalidatePcbConstraints+buildConstraintReportpass, and folds both intooverall_verdict:successonly when autorouting completed and DRC passed and the constraint report verdict isapproved; otherwisepartial(needs review) orfailed.
Vendor-neutral route-context export
easyeda_pcb_export_route_context (profile pro, read-only) exports the board as a Specctra DSN file via PCB_ManufactureData.getDsnFile — an open interchange format supported by external autorouters such as FreeRouting, not an EasyEDA-specific one. This is the "no vendor lock" escape hatch: if the native autorouter isn't available or doesn't produce a good result, route externally and re-import the result through EasyEDA Pro's own SES/DSN import — this server does not perform that re-import.
