Skip to content

Conversation

@seveibar
Copy link
Contributor

Motivation

  • Ensure final routed traces and vias respect the OBSTACLE_MARGIN by moving them away from other nets and obstacles near the end of the port-point pathing pipeline.
  • Improve robustness by breaking up long wire segments so a force-directed spacing pass can operate on smaller control points (default MIN_SEGMENT_SIZE = 0.5).
  • Provide a tunable force-directed stage to reduce DRC violations prior to path simplification and via merging.

Description

  • Added a new solver TraceSpacingSolver at lib/solvers/TraceSpacingSolver/TraceSpacingSolver.ts that uses a force-directed algorithm to repel points from segments, vias, and obstacles and recomputes vias after movement.
  • The solver subdivides long same-layer segments (configurable minSegmentSize), applies multiple substepForceIterations per step, and exposes parameters such as traceForceStrength, viaForceStrength, obstacleForceStrength, segmentObstacleForceStrength, damping, and maxPointDisplacement with sensible defaults.
  • Integrated the new solver as a pipeline step (traceSpacingSolver) in AutoroutingPipelineSolver2_PortPointPathing before TraceSimplificationSolver, wired its visualization into the combined pipeline view, and use its output routes downstream when present.
  • Minor safety: endpoints anchored to obstacles that the trace connects to are preserved, and the solver performs a tryFinalAcceptance to avoid blocking the pipeline.

Testing

  • Ran BUN_UPDATE_SNAPSHOTS=1 bun test tests/e2e3.test.ts which updated the SVG snapshot and passed the test, and the new DRC assertions reported no errors for that board.
  • Converted the solver output to circuit JSON and ran the DRC helper (getDrcErrors) during development to verify gaps were resolved for the e2e3 fixture.
  • Ran formatting with bun run format to normalize code style which completed successfully.
  • Ran bunx tsc --noEmit to typecheck the repo which surfaced pre-existing unrelated type errors in tests/core1.test.tsx, tests/core2.test.tsx, and tests/core3.test.tsx (these failures are not caused by this change).

Codex Task

@vercel
Copy link

vercel bot commented Dec 22, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
capacity-node-autorouter Ready Ready Preview, Comment Dec 22, 2025 1:20am

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants