kicad.js
kicad.js is a footprint viewer for KiCAD footprint files.
Installation
yarn install kicad.js
Usage
Here's a simple snippet that shows how to use kicad.js:
First you need to create a <canvas>
element somewhere. Give it an id and a
data attribute holding the url to the footprint file. Then preferebly at the
bottom of the page load the kicad.js file.
After that make another <script>
block.
You can set options to define grid size and colors for the footprint.
var options = grid: 127;
Then you need to find the canvas element for example with jQuery.
var canvas = ;
You can then create a KiCad object and attach it to the canvas with your set of options. Note that jQuery always returns a list of found elements, so you need to give it the first item in the list.
var kicadviewer = canvas0 options;
Finally download the footprint file for example with something like an AJAX call
and use the render(data)
function of your KiCad object to render the footprint.
Promise;
If everything works it should look like this: