Tooling
typeCAD provides a collection of tools to make the development process easier.
Project Creation
To create a new project enter the following command in your terminal:
npx --package=@typecad/typecad create-typecadThe first time, npx will ask you to download the script so it can run it.
Then you’ll be prompted to enter project details:
- name for the project
- if you want to create a PlatformIO project and if so, the board ID
- if you want to create a
gitrepository - install optional utility packages
A project will be created in the current directory. Inside the project directory, there will be a VSCode workspace file that will open the project in VSCode.
Non-interactive mode
All the information can be passed by command-line arguments and the script will automatically create a project. --help will show all the parameters.
npx --package=@typecad/typecad create-typecad --name=typecad_project --git=false --pio=falseThe above is the minimum to run automatically.
Project Use
A typeCAD project is just an npm package. All the normal npm-based tools are available to you. A package.json file is created with access to the following scripts:
- Project Building
- Adding Components
- Opening the
kicad_pcbfile in KiCAD
All of these commands are bundled into the npm package and can be easily run with simple clicks using VSCode. They are documented here for completeness.
Project Building
Click the Build script in VSCode’s NPM Scripts sidebar.
To build the project in a terminal, run the following command:
npx tsx [path/to/file.ts]The outputs will be in ./build/.
Adding Components
Components are discussed in the Components page. But for now, they are anything with a footprint that you’d add to your PCB like MCUs and resistors.
To add a component to the project:
npx --package=@typecad/typecad add-componentWhen the script runs, you’ll be asked the source for the symbol and footprint files. You can mix any of the sources ie. a KiCAD symbol, but a local file.
- If it’s a KiCAD library component, you’ll be prompted to enter the symbol and footprint names
- If it’s a local file, you’ll be prompted to enter the path to the file
- If it’s an EasyEDA/JLCPCB component, you’ll be asked for the
C###number
A [component].ts file will be generated along with instructions on how to use it. Files will also be copied into the ./build/ directory.
Non-interactive mode
All the information can be passed by command-line arguments and the script will automatically create a component. --help will show all the parameters.
npx --package=@typecad/typecad add-component --symbol_source=kicad --footprint_source=local --symbol=MCU_Microchip_ATtiny:ATtiny3227-M --footprint=MyLib:MyFootprint
npx --package=@typecad/typecad add-component --symbol_source=jlcpcb --footprint_source=kicad --c=C3217148 --footprint=Package_QFN:QFN-32-1EP_5x5mm_P0.5mm_EP3.45x3.45mmThe above is the minimum to run automatically.
There’s no need to add passives (resistors, capacitors etc.) this way. See the Passives page for more information.
Package Creation
typeCAD has a command-line tool to generate all the boilerplate code for a package. It sets up the package for easy publishing and reuse. It is discussed in more detail in the Package Overview page.
Execute the following command in ./hw of an already existing typeCAD project.
npx --package=@typecad/typecad add-packageOn This Page