Grid Locations¶
Package name: jitx/grid-locs
Often pads or components are arranged in a grid, row, or column. This file contains helpers for generating sequences of poses in a grid, row, or column pattern, which can be used in a for loop to place objects in the pattern.
Pad Placement Example¶
pcb-landpattern grid-lp :
for (i in 0 to 9, pos in grid-locs(3, 3, 1.0, 1.0)) do :
pad p[i] : smd-pad(0.5, 0.5) at pos
;Creates a landpattern with a 3x3 grid of SMD pads with 1.0 spacing
Summary¶
General Definitions¶
Definitions¶
General Definitions¶
col-locs¶
Column Locations
public defn col-locs (anchor:Anchor = ?, n:Int, dy:Double, start-anchor:Anchor = ?)
anchor: Anchor
- Anchor alignment of the row to the origin (must be one ofN
,C
, orS
) (default isC
)n: Int
- Number of locationsdy: Double
- Vertical spacing between each location in mmstart-anchor: Anchor
- Which end to start the sequence at (must beN
orS
) (default isN
)- Throws
Fatal
- error ifanchor
is notN
,C
, orS
or ifstart-anchor
is notN
orS
This is a helper function for generating a sequence of poses in a vertical column.
col-locs¶
public defn col-locs (n:Int, dx:Double, start-anchor:Anchor)
grid-locs¶
Grid Locations
public defn grid-locs (anchor:Anchor = ?, rows:Int, cols:Int, dx:Double, dy:Double, start-anchor:Anchor = ?, row-major?:True|False = ?)
anchor: Anchor
- Anchor alignment of the grid to the origin (default isC
)rows: Int
- Number of rowscols: Int
- Number of columnsdx: Double
- Horizontal spacing between each location in mmdy: Double
- Vertical spacing between each location in mmstart-anchor: Anchor
- Which corner to start the sequence at (must be one ofNW
,NE
,SW
, orSE
) (default isNW
)row-major?: True|False
- Whether to generate the locations in row-major order (default istrue
)
This is a helper function for generating a sequence of poses in a grid.
The alignment of the grid with respect to the origin can be controlled using
anchor
. For example, C
will produce a fully centered grid, N
will produce
a grid that is centered horizontally and with the top row at Y = 0.0, and
SW
will align the grid such that the bottom-left corner of the grid is at the
origin.
grid-locs¶
public defn grid-locs (rows:Int, cols:Int, dx:Double, dy:Double, start-anchor:Anchor, row-major?:True|False = ?)
grid-locs¶
public defn grid-locs (rows:Int, cols:Int, dx:Double, dy:Double, row-major?:True|False)
grid-locs¶
public defn grid-locs (anchor:Anchor, rows:Int, cols:Int, dx:Double, dy:Double, row-major?:True|False)
grid-locs¶
This is a variant which uses the X and Y coordinates of a point for specifying
public defn grid-locs (anchor:Anchor = ?, rows:Int, cols:Int, d:Point, start-anchor:Anchor = ?, row-major?:True|False = ?)
anchor: Anchor
- Anchor alignment of the grid to the origin (default isC
)rows: Int
- Number of rowscols: Int
- Number of columnsd: Point
- Point which represents the horizontal spacing in mm with its X coordinate and the vertical spacing with its Y coordinatestart-anchor: Anchor
- Which corner to start the sequence at (must be one ofNW
,NE
,SW
, orSE
) (default isNW
)row-major?: True|False
- Whether to generate the locations in row-major order (default istrue
)
the horizontal and vertical spacing, respectively, instead of two doubles.
grid-locs¶
public defn grid-locs (rows:Int, cols:Int, d:Point, start-anchor:Anchor, row-major?:True|False = ?)
grid-locs¶
public defn grid-locs (rows:Int, cols:Int, d:Point, row-major?:True|False)
grid-locs¶
public defn grid-locs (anchor:Anchor, rows:Int, cols:Int, d:Point, row-major?:True|False)
row-locs¶
Row Locations
public defn row-locs (anchor:Anchor = ?, n:Int, dx:Double, start-anchor:Anchor = ?)
anchor: Anchor
- Anchor alignment of the row to the origin (must be one ofE
,C
, orW
) (default isC
)n: Int
- Number of locationsdx: Double
- Horizontal spacing between each location in mmstart-anchor: Anchor
- Which end to start the sequence at (must beE
orW
) (default isW
)- Throws
Fatal
- error ifanchor
is notE
,C
, orW
or ifstart-anchor
is notE
orW
This is a helper function for generating a sequence of poses in a horizontal row.
row-locs¶
public defn row-locs (n:Int, dx:Double, start-anchor:Anchor)
Related Packages¶
Forwarded by package: jitx