grid_layout module#
- class GridPosition(row, column, pose)[source]#
Grid Position
This class represents a position in a grid of pads as well as a pose for the pad at that position. This is used by the
GridLandpatternGeneratorclasses during the construction of a landpattern.
- class GridLayoutInterface[source]#
Bases:
GridLayout,LandpatternProvider
- class A1[source]#
Bases:
GridLayoutInterfaceSimple utility mixin to offset the minor index to start at 1 instead of 0, e.g. A[1]. Note that this offsets the minor index, which is typically but not always the column, and the order matters if using a numbering mixin that changes that, going before such mixins as
ColumnMajorOrder.
- class ColumnMajorOrder[source]#
Bases:
GridLayoutInterfaceSimple utility mixin to index the grid in column-major order instead of row-major order.
- to_bga_row_ref(row)[source]#
Convert a row number into a alpha row reference
This function converts a zero-indexed row ordinal to a BGA-style alpha row reference string. The letters I, O, Q, S, X, and Z are skipped.
- For example:
0 -> “A” 1 -> “B” 19 -> “Y” 20 -> “AA” 39 -> “AY” 40 -> “BA” 419 -> “YY” 420 -> “AAA”
- class AlphaDictNumberingBase[source]#
Bases:
GridLayoutInterfaceBase class to provide a BGA-style alpha-numeric dictionary numbering scheme. The row is referred to by a letter as a member field, and the column is referred to by a number inside the dictionary at that field. No predefined rows are provided, and the intent is that this class is subclassed with declarations for all used rows. Note that the row letters skip the letters I, O, Q, S, X, and Z. If the exact rows are not known, then the
AlphaDictNumberingclass can be used instead to at least provide some type safety for the first 20 rows.>>> class My4RowNumbering(AlphaDictNumberingBase): ... A: dict[int, Pad] ... B: dict[int, Pad] ... C: dict[int, Pad] ... D: dict[int, Pad]
- class AlphaDictNumbering[source]#
Bases:
AlphaDictNumberingBaseAssign numbers to pads using an alpha-numeric dictionary. The row is referred to by a letter as a member field, and the column is referred to by a number inside the dictionary at that field. The row letters skip the letters I, O, Q, S, X, and Z. Note that the type checker is only aware of the first 20 rows, so will not provide type safety beyond that. From row 20 each row will be referred to by two letters, row 20 will be referred to as “AA”, row 21 as “AB”, and so on.
Note
Only used rows will have their fields set, but please note that the type checker will not flag access to rows even though they may not be set at runtime, resulting in an attribute error. When in doubt, use
inspectfunctions instead.
- class AlphaNumericNumberingBase[source]#
Bases:
GridLayoutInterfaceBase class to provide a BGA-style alpha-numeric numbering scheme. Pads are referred by a unique name consisting of the row letter and a number. It’s advisable to create a subclass with declarations for all used pads. Note that the row letters skip the letters I, O, Q, S, X, and Z. The column indicies start at 0 unless offset using, for example,
A1, and are not zero-padded.If pads are not known in advance, then introspection can be used to access pads with type safety, but without language server support. In this case it’s recommended to use something like the
AlphaNumericNumberingclass instead.>>> class My9PadBGANumbering(AlphaNumericNumberingBase, A1): ... A1: Pad ... A2: Pad ... A3: Pad ... B1: Pad ... B2: Pad ... B3: Pad ... C1: Pad ... C2: Pad ... C3: Pad
- class LinearNumbering[source]#
Bases:
GridLayoutInterfaceAssign numbers to pads using a linear numbering scheme, starting at pad number 1, accessed through
p[1]. Row and column indicies are ignored and pads are assigned in the generated order.