Skip to content

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

Function Description
col-locs (+ 1) Column Locations
grid-locs (+ 7) Grid Locations
row-locs (+ 1) Row Locations

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 of N, C, or S) (default is C)
  • n: Int - Number of locations
  • dy: Double - Vertical spacing between each location in mm
  • start-anchor: Anchor - Which end to start the sequence at (must be N or S) (default is N)
  • Throws Fatal - error if anchor is not N, C, or S or if start-anchor is not N or S

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 is C)
  • rows: Int - Number of rows
  • cols: Int - Number of columns
  • dx: Double - Horizontal spacing between each location in mm
  • dy: Double - Vertical spacing between each location in mm
  • start-anchor: Anchor - Which corner to start the sequence at (must be one of NW, NE, SW, or SE) (default is NW)
  • row-major?: True|False - Whether to generate the locations in row-major order (default is true)

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 is C)
  • rows: Int - Number of rows
  • cols: Int - Number of columns
  • d: Point - Point which represents the horizontal spacing in mm with its X coordinate and the vertical spacing with its Y coordinate
  • start-anchor: Anchor - Which corner to start the sequence at (must be one of NW, NE, SW, or SE) (default is NW)
  • row-major?: True|False - Whether to generate the locations in row-major order (default is true)

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 of E, C, or W) (default is C)
  • n: Int - Number of locations
  • dx: Double - Horizontal spacing between each location in mm
  • start-anchor: Anchor - Which end to start the sequence at (must be E or W) (default is W)
  • Throws Fatal - error if anchor is not E, C, or W or if start-anchor is not E or W

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