Format
All the coffeescript constructs can be found here.
For actual usage I suggest looking at the examples or just try things.
Constructors are used to make pads, lines, ...
Note that it is perfectly possible to make smds or pads that work fine in madparts but don't work in eagle and/or kicad. Keep the limits of your cad tools in mind :)
new Smd
new RoundPad r, drill
new SquarePad dia, drill
new LongPad dia, drill
new OctagonPad r, drill
new OffsetPad dia, drill
attribute | default | description |
---|---|---|
x | 0 | absolute x position of Smd |
y | 0 | absolute y position of Smd |
dx | 0 | width of Smd |
dy | 0 | height of Smd |
ro | 0 | roundness of Smd in % |
rot | 0 | rotation (0,90,180,270 allowed) |
name | name of Smd |
attribute | default | description |
---|---|---|
x | 0 | absolute x position of pad |
y | 0 | absolute y position of pad |
r | radius of the pad | |
drill | diameter of the drill | |
drill_dx | 0 | offset of the drill |
attribute | default | description |
---|---|---|
x | 0 | absolute x position of pad |
y | 0 | absolute y position of pad |
dx | 0 | width of pad |
dy | 0 | height of pad |
drill | diameter of the drill | |
drill_dx | 0 | offset of the drill |
ro | 0 | roundness of Smd in % |
rot | 0 | rotation (0,90,180,270 allowed) |
Equal to RectPad, but dx and dy re equal.
A LongPad is just a RectPad with dx = 2*dy and ro = 100.
attribute | default | description |
---|---|---|
x | 0 | absolute x position of pad |
y | 0 | absolute y position of pad |
r | radius of the pad | |
drill | diameter of the drill | |
drill_dx | 0 | offset of the drill |
An OffsetPad is just a LongPad with a drill_dx of -dy/2.
new Rect
new Disc r
new Circle w
new Hole drill
new Vertex w
new Line w
new Arc w
new Polygon w
new Name y
new Value y
new Label value
attribute | default | description |
---|---|---|
x | 0 | absolute x position |
y | 0 | absolute y position |
dx | 0 | width |
dy | 0 | height |
attribute | default | description |
---|---|---|
x | 0 | absolute x position |
y | 0 | absolute y position |
r | radius |
attribute | default | description |
---|---|---|
x | 0 | absolute x position |
y | 0 | absolute y position |
r | 0 | radius |
w | width |
attribute | default | description |
---|---|---|
x | 0 | absolute x position |
y | 0 | absolute y position |
drill | diameter of drill |
attribute | default | description |
---|---|---|
x1 | 0 | absolute x1 position |
y1 | 0 | absolute y1 position |
x2 | 0 | absolute x2 position |
y2 | 0 | absolute y2 position |
w | width | |
curve | 0 | curvage |
A Line is just a Vertex with curve=0.
An Arc is just a vertex with typically curve!=0.
attribute | default | description |
---|---|---|
w | width | |
v | [] | list of vertices |
Normally you don't manipulate the list of vertices directly, but use the following methods on the Polygon object instead.
method | description |
---|---|
start x1,y1 | start polygon |
add x1,y1(,curve) | add a point, with optional curvage |
end () | end polygon |
end curve | end polygon with curvage |
Note that eagle supports curves in polygons but kicad does not at the moment, meaning the curvage will not be there when exported to kicad.
attribute | default | description |
---|---|---|
x | 0 | absolute x position |
y | 0 | absolute y position |
value | text to be displayed |
A Name is just a Label with the special value "NAME".
attribute | default | description |
---|---|---|
x | 0 | absolute x position |
y | 0 | absolute y position |
value | "NAME" | name of part |
Note that madparts assumes the values "NAME" and "VALUE" are special and they map on the special constructs for names and values in both eagle and kicad.
A Value is just a Label with the special value "VALUE".
attribute | default | description |
---|---|---|
x | 0 | absolute x position |
y | 0 | absolute y position |
value | "VALUE" | value of part |
Note that madparts assumes the values "NAME" and "VALUE" are special and they map on the special constructs for names and values in both eagle and kicad.
-
clone
makes a deep copy of an item. You need to take a clone if you want to base another shape on an existing shape. -
rotate90
,rotate180
,rotate270
rotate a shape around the origin. -
rotate90pad
, rotate180pad,
rotate270pad` are the same, but they only work on pads and smds. -
mirror_y
andmirror_x
mirror a shape. -
adjust_x
andadjust_y
adjust x or y for a shape. -
lines
creates a sequence of lines with a certain width. -
silk_square
draws a square of silk lines -
single
andsingle_rot
generate a single line of vertical or horizontal pads in a list. -
dual
,alt_dual
,rot_dual
andalt_rot_dual
generate a dual line of vertical or horizontal pads in a list. thealt
variants have alternating pad numbers. -
quad
generates a quad layout list of pads. -
make_rect
makes draws a simple rect based on dx, dy, line_width and type. -
remove
allows removing a pad/smd from a list typically generated by one of the single, dual, ... methods above by name
Internally madparts classifies layers by types. This table shows how types are mapped onto eagle or kicad layers.
type | eagle num | eagle name | kicad num | kicad name |
---|---|---|---|---|
smd | 1 | Top | F.Cu | |
pad | 17 | Pads | F.Cu | |
silk | 21 | tPlace | 21 | F.SilkS |
name | 25 | tNames | F.SilkS | |
value | 27 | tValues | Dwgs.User | |
stop | 29 | tStop | 23 | F.Mask |
glue | 35 | tGlue | 17 | F.Adhes |
keepout | 39 | tKeepout | ||
restrict | 41 | tRestrict | ||
vrestrict | 43 | vRestrict | ||
docu | 51 | tDocu | 24 | Dwgs.User |
hole | 28 | Edge.Cuts |