Skip to content

Commit

Permalink
add kicad-pro file to kicad project (#514)
Browse files Browse the repository at this point in the history
* add kicad-pro file to kicad project

* update dependicies
  • Loading branch information
Anshgrover23 authored Jan 8, 2025
1 parent ece01b1 commit 55cd74e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
Binary file modified bun.lockb
Binary file not shown.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"jose": "^5.9.3",
"jscad-electronics": "^0.0.24",
"jszip": "^3.10.1",
"kicad-converter": "^0.0.10",
"kicad-converter": "^0.0.16",
"lucide-react": "^0.445.0",
"ms": "^2.1.3",
"next-themes": "^0.3.0",
Expand Down
7 changes: 7 additions & 0 deletions src/lib/download-fns/download-kicad-files.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { saveAs } from "file-saver"
import { convertCircuitJsonToKiCadPcb } from "kicad-converter"
import { convertCircuitJsonToKicadPro } from "kicad-converter"
import { AnyCircuitElement } from "circuit-json"
import JSZip from "jszip"

Expand All @@ -12,8 +13,14 @@ export const downloadKicadFiles = (
typeof kicadPcbString === "object"
? JSON.stringify(kicadPcbString)
: kicadPcbString

const kicadProContent = convertCircuitJsonToKicadPro(circuitJson)
const proContent = JSON.stringify(kicadProContent)

const zip = new JSZip()
zip.file(`${fileName}.kicad_pcb`, pcbContent)
zip.file(`${fileName}.kicad_pro`, proContent)

zip.generateAsync({ type: "blob" }).then((content) => {
saveAs(content, `${fileName}_kicad.zip`)
})
Expand Down

0 comments on commit 55cd74e

Please sign in to comment.