Skip to content

Commit

Permalink
library and cli usage in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
seveibar committed Oct 25, 2024
1 parent 55d93ff commit 0bfb71c
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

Convert a [Circuit JSON](https://github.com/tscircuit/circuit-json) to Gerber/Excellon files.

## Installation

```bash
# Global installation for CLI usage
npm install -g circuit-json-to-gerber
```

## CLI Usage

Convert a circuit JSON file to Gerber/Excellon files:
Expand All @@ -20,6 +27,38 @@ The output ZIP file will contain:
- Plated drill file (plated.drl)
- Unplated drill file (unplated.drl)

## Library Usage

```typescript
import {
convertSoupToGerberCommands,
stringifyGerberCommandLayers,
} from "circuit-json-to-gerber"
import {
convertSoupToExcellonDrillCommands,
stringifyExcellonDrill,
} from "circuit-json-to-gerber"

// Convert Circuit JSON to Gerber commands
const gerberCommands = convertSoupToGerberCommands(circuitJson)

// Convert to Gerber file content
const gerberOutput = stringifyGerberCommandLayers(gerberCommands)

// Generate drill files
const platedDrillCommands = convertSoupToExcellonDrillCommands({
circuitJson,
is_plated: true,
})
const unplatedDrillCommands = convertSoupToExcellonDrillCommands({
circuitJson,
is_plated: false,
})

const platedDrillOutput = stringifyExcellonDrill(platedDrillCommands)
const unplatedDrillOutput = stringifyExcellonDrill(unplatedDrillCommands)
```

## References

- [Gerber Format Specification (2022)](https://www.ucamco.com/files/downloads/file_en/456/gerber-layer-format-specification-revision-2022-02_en.pdf?7b3ca7f0753aa2d77f5f9afe31b9f826)
Expand Down

0 comments on commit 0bfb71c

Please sign in to comment.