kicad2ems.core.board¶
The canonical board: what every solver gets, from any importer (units mm, model
coordinates: y up, the negative of KiCad's y).
board = Board(raw, nets=['RF', 'GND'], pos_file='board-top.pos',
ground='B.Cu')
# resolve an import
board.save('board.json'); board = Board.load('board.json')
# the file contract
board.summary()
# what the parity checks compare (copper area per layer and net, ...)
layers dielectric slabs dict(name, z0, z1, er, tand, kind), bottom to top
cu_z, cu_t copper layer heights and thicknesses (cu_order: bottom to top);
thickness: the stack's
outline the dielectric's extent: the board outline, cropped to the region
if one is given
copper {layer: [polygons]} the selected copper, merged per layer;
copper_nets: the net of each
vias [(x, y, radius, z0, z1)] plated holes as metal cylinders;
via_nets, via_signal (on a port net)
ports [Port] from the P<n> footprints, the settings and region cuts;
user_ports groups the legs of differential ports
parts [parts.Part] lumped R / L / C parts between two pads
walls [(axis, coord, t0, t1, z0, z1)] edge walls where the ground planes
end (edges.py)
solids drawn 3D shapes (core.shapes.apply): dict(shape, material, z0,
z1, er, tand, polygon); the FDTD and Palace mesh them
(core.solids)
prims the primitives behind the copper, for the line model: items,
shapes, tracks, footprints, vias
ground, ground_nets, signal_nets, sel (the nets kept; None: all), region,
cut_sides, notes, source, request
Physical intent only: what is on the board and what was asked for. Nothing is
snapped to a mesh, split for a solver or fitted: the solvers do that, and say
so. board.json holds all of it (format kicad2ems-board, version 1); a reader
refuses a newer major version and ignores keys it does not know.
- class kicad2ems.core.board.Board(raw, nets=None, pos_file=None, include_mask=False, region=None, ground=None, parts='auto', log=<built-in function print>, ports=None, cut_ports=False, edge_walls=(), edge_keepout=0.5, need_ports=True, fill_voids='off', part_ports=(), shapes=None)[source]¶
The board of a run, resolved from an imported board (`raw`: KiCadBoard, GerberBoard) and the selection settings: nets, pick-and-place file, solder mask, region, solid ground layer, lumped parts, extra ports, ports where tracks cross the region edge and edge walls. need_ports=False: a board without ports is fine (the KiCad plugin's impedance map, before any are placed).
- copper_at(lay, pt)[source]¶
The modelled copper polygon on layer `lay` containing point pt (model coordinates), or None.
- describe()[source]¶
The board as the log shows it: the stack, the copper, the outline and vias, each port and part, the notes.
- net_at(lay, x, y)[source]¶
Net of the selected copper on layer `lay` at model point (x, y), or None.
- property signal_nets[source]¶
The nets of the traces the ports sit on; vias on them are 'signal vias'.
- summary(nd=4)[source]¶
The numbers two boards (two importers, a refactor, a solver's readback) should agree on: the stack, copper area per layer and net, vias, ports, parts, edge walls, the outline (rounded to nd decimals).
- class kicad2ems.core.board.Port(name, layer, z_sig, z_ref, c, axis, sgn, w, z0, leg=None, pair=None, ref_layer='', kind='z', gap=None, net=None, source='', internal=False, d=None)[source]¶
Lumped port. kind 'z': a vertical sheet across the trace from the reference copper to the trace (feed lines over a plane); kind 'gap': a sheet in the copper plane across a gap between two conductors on the same layer (centre-fed dipoles, gap feeds), from gap[0] to gap[1] along axis. c is the port's centre, d the unit direction into the circuit (a vertical port's trace at any angle, R-E1), axis (0: x, 1: y) and sgn its dominant axis and sign there (the port's sheet is normal to that axis), w the trace's width.
- class kicad2ems.core.board.Prims(items=(), shapes=(), tracks=(), vias=(), footprints=())[source]¶
The primitives the copper is made of, in model coordinates (what the line model reads): items [(layer, net, geometry)], shapes (the zones and drawn copper among the items), tracks [dict(layer, net, width, pts)], vias [dict(x, y, size, drill, layers, net[, pth])] and footprints [dict(ref, value, props, x, y, rot, side, dnp, exclude_from_sim, pads [dict(name, xy, layers, net, geom, rot)])].
- kicad2ems.core.board.cross_section(cu, probe, t, reach=20.0)[source]¶
Width (mm) and mid point of the copper polygon `cu` along the line through `probe` in direction t (unit vector): the piece of that line inside the copper nearest to the probe.