Giter Club home page Giter Club logo

pcbdraw-lib's Introduction

PcbDraw-Lib

Model library for PcbDraw - tool for creating awesome looking PCB drawings.

Usage

Clone the repository to your computer and specify one of the directories as a library when using PcbDraw. Currently there following libraries:

  • KiCAD-base - module library in a standard style for components from KiCAD standard libraries.
  • Eagle-export - module library in a standard style for components on imported Eagle boards. This library is held separately as the import of Eagle boards to KiCAD looses library information and component names do not follow KiCAD conventions.

Important note for PcbDraw version > 0.6

PcbDraw v0.6 is the last version, that uses the old library format, where 1mm = 1 user unit. We no longer require this and you can use arbitrary units. The library have been migrated, however, if you use custom libraries, you might have to migrate them. You can do so by invoking migrate_footprint.py from the directory scripts on every footprint. I am sorry about this breaking change, but it will make creating the libraries less confusing for the future!

Creating Modules

Module is an SVG file containing a single component drawing. There are some rules below, but if you are interested in seeing a quick guide, jump to the section "Module drawing walkthrough"

The file has to follow these rules:

  • the SVG image of the component should have size and viewbox attributes set
  • the units in the SVG should be chosen such that they correspond to the physical size
  • it contains one element with id=origin having attributes x and y. Its coordinates serve as a module origin.
  • origin should be a red rectangle of size 1x1.
  • modules should not be too simplified (for example it is not OK for LED to be just a color circle).
  • module is named exactly the same as the corresponding KiCAD footprint. The extension is changed to .svg.
  • for each module there is a corresponding drawing with suffix '.back.svg' (for 'pinheader.svg' there is a 'pinheader.back.svg'). This drawing contains view of the module from the other side of the board.
  • each component should be placed on a tight canvas. The canvas size determines the highlighted area in component highlight.

Modules are placed in directories corresponding to KiCAD footprint libraries. If multiple footprints are represented using one module, the module should not be duplicated but symlinked.

Directory scripts contains script for automatic generation of modules - e.g. pin headers, DIP packages, QFN packages, etc...

Side note: reasoning behind explicitly specifying origin. Even SVG format supports units and origin can be placed at SVG (0,0) point, it not that easy in practice. Most of the editors do weird things with coordinate system. Inkscape, for example, reverses Y-axis and translates the origin by the initial size of document. When you change the size of the document, the coordinates are not modified. Therefor, I find placing origin component as the simplest solution which should be compatible with any editor.

Module drawing walkthrough

When you want to draw a component that is absent in the library, the easiest is to use scripts/create_template.py. This small script takes a *.kicad_mod file and outputs a SVG template for drawing. Let's say we would like to draw a resistor. Therefore, we locate the corresponding *.kicad_mod file and invoke it like this:

scripts/create_template.py footprint --front \
  /usr/share/kicad/modules/Resistor_SMD.pretty/R_1206_3216Metric.kicad_mod \
  KiCAD-base/Resistor_SMD.pretty/R_1206_3216Metric.svg

This will generate the following R_1206_3216Metric.svg file:

Template1

As you can see, it is roughly the KiCAD footprint. There is a red square. This square represent the footprint origin. Keep it in the file and don't move it!

With this set up, we can draw the footprint to be nice:

Template2

Once we are done, we can remove the "KiCAD footprint" layer:

layers

Then we can shrink the document to size (under File -> Document Properties):

shrinking

And Voilà! You just created a first, nicely-looking footprint:

Template3

Note that you can use the same procedure with the switch --back for the back side of the component.

Contributing

Please, help to increase usability of PcbDraw by adding more modules to the library. Feel free to submit a pull request with new modules.

pcbdraw-lib's People

Contributors

electro707 avatar nobodywasishere avatar nt7s avatar set-soft avatar testudor avatar yaqwsx avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.