kicad2ems.core.solids

A board's drawn solids (board.solids: core.shapes.apply) resolved into what a
volume solver meshes: disjoint pieces, each an outline extruded between two
heights and of one material. The FDTD model (fdtd.model; its mesh lines:
fdtd.mesh.solid_lines) and Palace's (fem.palace.model) both build from them.

    ps = pieces(board)      # [Piece(material, er, tand, polygon, z0, z1, ...)]
    extent(board)           # (x0, y0, z0, x1, y1, z1) of the board and solids
    enclosure(board, ps, d) # the drawn metal's box, if it closes round the board

How they combine, with each other and with the board:

  - a later solid wins over an earlier one where they overlap (the drawing's
    order): an air box drawn inside a metal box hollows it into a shell;
  - a solid that encloses the whole board (its outline in plan, and the
    dielectric stack's full height, and more than just the board) is around
    the board: inside it the board's dielectric stays as it is, and the
    board's cut-outs take the solid's material (a can and the air inside it,
    a potting compound);
  - any other solid is drawn into the board: where it meets the dielectric it
    takes its place (a slot or a pocket of air, a metal post, an insert of
    another laminate);
  - the board's copper, vias, edge walls, ports and parts stay over every solid
    (a cut takes copper out: the 'cut' material, on a copper layer);
  - a magnet is a metal piece to the RF (Piece.magnet: its remanence; with
    conductor loss, MAGNET_SIGMA) and a ferrite a dielectric one that a
    solver must also magnetise (Piece.ferrite); core.magnets has their static
    field.

Pieces are in the board's own heights (the FDTD maps them with its thick-copper
plan). Nothing is snapped to a mesh here.
class kicad2ems.core.solids.Piece(material: str, er: float, tand: float, polygon: object, z0: float, z1: float, index: int, name: str, around: bool = False, ferrite: dict = None, magnet: float = None)[source]
One disjoint piece of a solid: `polygon` (shapely, holes allowed, model
mm) from z0 to z1 (mm, z0 <= z1; equal: a sheet, metal only), of `material`
(metal, dielectric, air, ferrite; er and tand for a dielectric or a
ferrite). index: the solid's place in board.solids (the drawing's order);
name: its shape's; around: it encloses the board (the board's dielectric
left out of it). ferrite: dict(ms=4 pi Ms G, dh=Oe) of a ferrite; magnet:
the remanence (T, + along +z) of a magnet, whose material is metal.
kicad2ems.core.solids.board_volume(board)[source]
(outline, zb, zt): the board's dielectric (its outline with its
cut-outs, from the stack's bottom to its top), or None without layers.
kicad2ems.core.solids.describe(ps)[source]
The pieces in a few words: '3 drawn solids as 4 pieces: metal 2,
air 1, dielectric 1 (er 9.8)'.
kicad2ems.core.solids.encloses(board, d, vol=None)[source]
Whether solid d (a board.solids dict) encloses the whole board: its
outline round the board's in plan, its heights round the stack's, and
more than the board itself (a solid of just the board's outline and
stack takes the dielectric's place: the substrate made air or another
laminate).
kicad2ems.core.solids.enclosure(board, ps, domain)[source]
The box (x0, y0, z0, x1, y1, z1) of the drawn metal when it closes round
the board: no way through from the board's ports (or the middle of its
stack, with none) to the faces of `domain` (the same six numbers) other
than through metal; None when there is one, or when the board pokes out
of the metal's box. Outside a closed metal shell the fields are nothing:
a solver need not mesh past it.

The domain is cut at every metal height; in each slab the space that is
not metal falls into pieces in plan; a piece touching the domain's sides,
or in the bottom or top slab, is open, and so is any piece that overlaps
(in plan, past the metal sheets at their height) an open one in the slab
above or below.
kicad2ems.core.solids.extent(board, ps=None)[source]
(x0, y0, z0, x1, y1, z1) mm round the board's outline and stack and its
solids' pieces (ps: pieces(board)).
kicad2ems.core.solids.pieces(board)[source]
The drawn solids (board.solids) as disjoint [Piece], by the module's
rules: in the drawing's order, then by height. A metal solid of no
thickness is a sheet (z0 = z1); a dielectric or air one of none is left
out.