Giter VIP home page Giter VIP logo

kicad-footprint-generator's Introduction

This repository contains scripts to generate custom KiCAD footprints using python, and a framework which allows us to create custom KiCAD footprint. A big bunch of footprints of the KiCad library was developed using this framework.

KicadModTree

Licence: GNU GPLv3+

Maintainer: Thomas Pointhuber

Build Status Code Climate Documentation Status

Supports: Python 2.7 and 3.3+

About

I started drawing a bunch of similar footprints for KiCAD, like connectors which are mainly one base shape, and different amount of pins. To be able to update/improve those footprints quickly I decided to write my own footprint generator Framework, to allow simple creation of easy as well complex shapes.

This is my second approach (the first one can be found in the git history). This solution should be able to be easy to use, to read and also be easy to expand with custom nodes.

Overview

This framework is mainly based on the idea of scripted CAD systems (for example OpenSCAD). This means, everything is a node, and can be structured like a tree. In other words, you can group parts of the footprint, and translate them in any way you want. Also cloning & co. is no problem anymore because of this concept.

To be able to create custom Nodes, I separated the system in two parts. Base nodes, which represents simple structures and also be used by KiCAD itself, and specialized nodes which alter the behaviour of base nodes (for example positioning), or represent a specialized usage of base nodes (for example RectLine).

When you serialize your footprint, the serialize command only has to handle base nodes, because all other nodes are based upon the base nodes. This allows us to write specialized nodes without worrying about the FileHandlers or other core systems. You simply create your special node, and the framework knows how to handle it seamlessly.

Please look into the Documentation for further details

KicadModTree        - The KicadModTree framework which is used for footprint generation
docs                - Files required to generate a sphinx documentation
scripts             - scripts which are generating footprints based on this library

Development

Install development Dependencies

manage.sh update_dev_packages

run tests

manage.sh tests

Example Script

from KicadModTree import *

footprint_name = "example_footprint"

# init kicad footprint
kicad_mod = Footprint(footprint_name)
kicad_mod.setDescription("A example footprint")
kicad_mod.setTags("example")

# set general values
kicad_mod.append(Text(type='reference', text='REF**', at=[0, -3], layer='F.SilkS'))
kicad_mod.append(Text(type='value', text=footprint_name, at=[1.5, 3], layer='F.Fab'))

# create silscreen
kicad_mod.append(RectLine(start=[-2, -2], end=[5, 2], layer='F.SilkS'))

# create courtyard
kicad_mod.append(RectLine(start=[-2.25, -2.25], end=[5.25, 2.25], layer='F.CrtYd'))

# create pads
kicad_mod.append(Pad(number=1, type=Pad.TYPE_THT, shape=Pad.SHAPE_RECT,
                     at=[0, 0], size=[2, 2], drill=1.2, layers=Pad.LAYERS_THT))
kicad_mod.append(Pad(number=2, type=Pad.TYPE_THT, shape=Pad.SHAPE_CIRCLE,
                     at=[3, 0], size=[2, 2], drill=1.2, layers=Pad.LAYERS_THT))

# add model
kicad_mod.append(Model(filename="example.3dshapes/example_footprint.wrl",
                       at=[0, 0, 0], scale=[1, 1, 1], rotate=[0, 0, 0]))

# output kicad model
file_handler = KicadFileHandler(kicad_mod)
file_handler.writeFile('example_footprint.kicad_mod')

kicad-footprint-generator's People

Contributors

poeschlr avatar pointhi avatar jkriege2 avatar schrodingersgat avatar evanshultz avatar antoniovazquezblanco avatar stoth avatar grob6000 avatar ppelleti avatar misca1234 avatar asukiaaa avatar ratfink avatar mrq avatar twam avatar shackmeister avatar dasfrank avatar terjeio avatar robertlong13 avatar s-light avatar jneiva08 avatar matyro avatar jcassette avatar penoud avatar frankkkkk avatar jordiorlando avatar kh4 avatar schlumpf avatar seands avatar tvannoy avatar dogtopus avatar

Watchers

James Cloos avatar Tim Pambor 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.