Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

kicad_mod_generator

Jose Ignacio Romero edited this page Aug 25, 2016 · 13 revisions

Idea would be generating models using python as base language. The whole framework/library should be made in a way where scripting a component is as simple as possible without too much general/structural/reppetive code for each component script.

Current project members:

  • @pointhi (irc: pointhi) (footprint generator)
  • @iromero91 (irc: cyborg_ar) (3d model generator)

API-Idea (@pointhi)

using an argparse similar api, which is build in a way to support different types of input (csv, yml, call inside python script). So you simply add something like this as generic structure:

from kicad_mod_generator import parser

parser = KicadModParser(MyFootprint)  # it's only a concept

class MyFootprint(KicadFootprint):
    def __init__(self):
        pass

    def arguments(self):
        parser.addArgument('name', type=str)
        parser.addArgument('datasheet', type=str)
        parser.addArgument('dimension_A', type=int)
        parser.addArgument('dimension_B', type=int)
        parser.addArgument('Dimension_C', type=int)

    def generate_footprint(self, out_file):
        return None

    def generate_3d_model(self, out_file):
        return None

if __name__ == '__main__':
    parser.parse()

The script should be able to be called like:

./demo_footprint.py spec1.csv spec2.csv spec3.yml -v dir=Demo.pretty

But also inside python (where I have to think of an implementation ^^)

Grammar for dimensions

To make an IPC compliant footprint generator, the component dimensions must be specified with tolerances, either as an interval of maximum and minimum, or as a nominal value with a +/- tolerance. Examples:

  1. 4.3 Exact nominal value
  2. 4.3+-0.3 Nominal value and symmetrical tolerance (4.0 to 4.6)
  3. 4.3+0.0-0.5 Nominal value with asymmetrical tolerances (3.8 to 4.3)
  4. 4.0_4.6 Range tolerance (identical to example 2)
  5. <4.6 or _4.6 Only maximum value
  6. >4.3 or 4.3_ Only minimum value

By default the quantities would be only in mm, but it could be possible to accept other units like mils later on (fairly low priority).

Clone this wiki locally