Skip to main content
← Back to kicad-monkey Rust Docs kicad-monkey Rust Crate API Reference

Module diodes

Module diodes 

Source
Expand description

Virtual diode orientation layers (DIODES_TOP, DIODES_BOTTOM).

Full pure-Rust parity with Python’s kicad_monkey.fab.virtual._diodes:

Resolution precedence per fitted component on the requested side:

  1. Per-component config override (DiodeOptions.overrides.<ref>)
  2. Footprint parameters on FabComponent.parameters:
    • CATHODE_PAD (if present, skips auto-detection heuristics; value "none"/"false"/"off"/"no"/"0"/"disable"/"disabled" suppresses)
    • optional ANODE_PAD
    • optional DIODE_TYPE (normal, led, schottky, zener, tvs)
    • optional DIODE_COLOR (hex #RRGGBB or named color for SVG shading)
    • optional DIODE_SYMBOL visibility boolean
  3. Auto-detection heuristics (only when neither override nor CATHODE_PAD decided):
    • 2-terminal fitted part matching designator_prefixes (e.g. D, LED) or ASCII word-boundary keywords across designator, description, value, footprint, and parameters (blocked when prefix belongs to another passive family such as C/L/R)
    • Pad name polarity hints (K/C/CATHODE/CAT/- vs A/ANODE/ANO/+), falling back to default_cathode_pad (default "2")

Glyph geometry follows PCBE’s terminal_presentation_geometry.rs: axis shaft, filled triangle pointing anode -> cathode, subtype-specific cathode bar (straight / Schottky S-hook / Zener & TVS angled wings), and LED light-ray arrows.

Structs§

DiodeGlyph
Complete styled vector geometry of one diode symbol (+Y up, whole nm).
DiodeGlyphStroke
One straight stroke segment in a diode glyph (+Y up, whole nm).
DiodeOptions
Configuration for DIODES_TOP and DIODES_BOTTOM detection and rendering.
DiodeOverride
Per-component diode polarity and style override.
ResolvedDiode
Resolved diode polarity, subtype, and shading palette for one component.

Enums§

DiodeColorMode
SVG color rendering mode for virtual diode overlays.
DiodeStrokeKind
Semantic kind of one stroke inside a diode glyph.
DiodeType
Canonical diode subtype.
DiodeVisibilityMode
Visibility mode for diode virtual layers.

Functions§

build_diode_glyphs
Build full styled diode glyphs on side for SVG or Gerber lowering.
build_diodes_layer
Build canonical monochrome FabLayerItems for DIODES_TOP or DIODES_BOTTOM.
darken_hex
Darken a #RRGGBB hex color by factor (matching Python _darken_hex).
resolve_diodes
Resolve all visible diode components on side.