Skip to content

wholeboard.models3d

KiCad 3D models: find or download them so renders show real parts, and measure part heights.

Footprints point at models as ${KICADn_3DMODEL_DIR}/.3dshapes/.step. KiCad's installers usually bring the models; when they are missing (the Docker image, Linux packages without kicad-packages3D) each model a board uses is downloaded once from KiCad's GitLab into a cache.

rel_path(path)

'${KICAD10_3DMODEL_DIR}/Package_SO.3dshapes/SOIC-8.wrl' -> 'Package_SO.3dshapes/SOIC-8.step'.

local(rel)

A model already on this computer, in KiCad's folders or the download cache.

fetch(rel, timeout=40)

Download one model into the cache. Returns None if KiCad has no such model.

prepare(pcb, out_pcb, download=True, log=print)

Copy a board with every model path made absolute, downloading models that are missing.

step_bbox(f)

[xmin, ymin, zmin, xmax, ymax, zmax] of a STEP file's points, in mm.

model_height(m)

How far one footprint model rises from the board, using KiCad's offset, scale and rotation.

footprint_height(fp)

The tallest visible model of a footprint from geometry.read, or None if none is on disk.

easyeda_height(lcsc, download=True, timeout=30)

A part's height from the 3D model on its LCSC/EasyEDA page: the model's name (…-H1.4-…) or its mesh.

part_height(fp, lcsc=None, download=False)

(height, source) for a footprint: KiCad's model first, then EasyEDA's by LCSC number.

mode(cfg=None)

'auto' downloads missing models, 'local' uses installed ones only, 'off' renders bare boards.