This library parses Specctra DSN files and converts them into JSON. It can also convert Specctra DSN files into tscircuit JSON and serialize them back to DSN.
This library parses Specctra DSN files and converts them into JSON for interoperability. It has no official relationship with Specctra, Cadence, or the Allegro PCB Router.
To install the package, run:
npm install specctra-dsn-json
Here's a basic example of how to use the library:
import { parseDsnToJson } from "@tscircuit/specctra-dsn-json"
const dsnContent = `
(pcb "example.dsn"
(parser
(string_quote ")
(space_in_quoted_tokens on)
)
(resolution um 10)
(unit um)
...
)
`
const jsonOutput = parseDsnToJson(dsnContent)
console.log(JSON.stringify(jsonOutput, null, 2))
- Parses Specctra DSN files into a structured JSON format
- Supports various elements of the DSN format including:
- Parser information
- Resolution and units
- Structure (layers, boundaries, vias, rules)
- Component placement
- Library definitions
- Network and wiring information
- Provides a type-safe interface using Zod schemas
To set up the project for development:
- Clone the repository
- Install dependencies:
npm install
- Run tests:
npm test
To build the project:
npm run build
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.