Git Product home page Git Product logo

juicy-footprint's Introduction

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

juicy-footprint's People

Contributors

domoszlai avatar

Stargazers

b-17bombor 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.