An SMD Footprint designer DSL
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
footprint-library
sample-mcusb-java
sample-mcusb-scala
.travis.yml
LICENSE
README.md
build.gradle
common.gradle
settings.gradle

README.md

Juicy-footprint: An SMD Footprint designer DSL

Travis

Synopsis

Juicy-footprint is a domain specific language written in/for Java and Scala to design/reconstruct SMD footprints from the Recommended PCB Layout of the datasheet of an SMD component. Recommended PCB Layouts are usually given as engineering drawings where the distances between the parts are relative to each other. Most EDA applications, however, e.g. Eagle, requires SMD footprints to be given in absolute coordinates.

Figuring out absolute coordinates from engineering drawings can be exhausting and error-prone. Juicy-footprint is designed to help with resolving this impedance mismatch. The drawings can be directly represented with the Juicy-footprint DSL, which, when executed, provides absolute coordinates and displays the footprint.

For a tutorial of its usage visit http://dlacko.org/blog/2018/01/10/scala-smd-footprint-designer-dsl/.

Installation

The easiest way to install is to download one of the pre-built packages from releases.

Alternatively, you can build from the source code as follows:

  • Install Gradle if you do not have it yet
  • $ git clone https://github.com/domoszlai/juicy-footprint.git
  • $ gradle build

The DSL

With juicy-footprint one creates shapes and defines relations between their properties (called constraints). The available shapes and their properties are the following:

  • Variable: relations can be defined between variables
  • Point
    • x: Variable
    • y: Variable
  • HorizontalLine, VerticalLine
    • p1: Point
    • p2: Point
    • length: Variable
  • Rect
    • top: HorizontalLine
    • bottom: HorizontalLine
    • left: VerticalLine
    • right: VerticalLine
    • width: Variable
    • height: Variable
  • Hole
    • top: Point
    • bottom: Point
    • left: Point
    • right: Point
    • center: Point
    • radius: Variable
  • Pad
    • topLeft: Point
    • topRight: Point
    • bottomReft: Point
    • bottomRight: Point
    • center: Point
    • centerTop: Point
    • centerBottom: Point
    • centerLeft: Point
    • centerRight: Point
    • width: Variable
    • height: Variable

The constraints must be linear, only addition and multiplication with a constant are allowed. As a basic example, the following pseudo-code creates two pads the same size, and defines a distance of 6.4mm between their center points:

var a = createPad()
a.width = 1.5
a.height = 1
var b = createPad()
b.width = a.width
b.height = a.height

b.centerTop.x = a.centerTop.x + 6.4
b.centerTop.y = a.centerTop.y

Java

The same code in Java would be as follows:

Layouter l = new Layouter();

Pad a = l.createPad("A", 1.5, 1);
Pad b = l.createPad("B", a.getWidth(), a.getHeight());

b.getCenterTop().addConstraint(a.getCenterTop(), 6.4, 0);

Unfortunately the lack of some language features, e.g. operator overloading and properties, in Java, makes the code unintuitive and cumbersome.

Subproject sample-mcusb-java describes the footprint of a micro USB connector as a full-fledged example.

Scala

The same code in Scala is more intuitive thanks to its advanced language features:

Layouter l = new Layouter();

val a = l.createPad("A", 1.5, 1);
val b = l.createPad("B", a.width, a.height);

b.centerTop ~= a.centerTop + (6.4, 0);

Subproject sample-mcusb-scala describes the footprint of a micro USB connector as a full-fledged example.

Implementation

Juicy-footprint is based on the EJML linear algebra library to solve the linear equation system defined by the constraints between the variables. It uses javafx to display the footprints.

Generated layout