pub struct Symbol {
pub unit_count: u32,
pub properties: BTreeMap<String, String>,
pub power_net: Option<String>,
pub library_id: String,
pub reference_prefix: String,
pub description: String,
pub graphics: Vec<Graphic>,
pub pins: Vec<Pin>,
pub graphic_gates: Vec<u32>,
pub hide_pin_names: bool,
pub hide_pin_numbers: bool,
}Fields§
§unit_count: u32§properties: BTreeMap<String, String>§power_net: Option<String>§library_id: String§reference_prefix: String§description: String§graphics: Vec<Graphic>§pins: Vec<Pin>§graphic_gates: Vec<u32>The gate (Pin::gate) each of Symbol::graphics is drawn with, by
index. A graphic past the end of this list, or tagged 0, belongs to no
gate and is drawn where the component itself is. Empty for a symbol not
split into gates, and then omitted.
hide_pin_names: boolKiCad’s symbol-level (pin_names (hide yes)): the pins keep their names,
and the sheet does not print them. A connector’s Pin_1 … Pin_4 or a
resistor’s ~ say nothing the pin number does not.
hide_pin_numbers: boolKiCad’s symbol-level (pin_numbers (hide yes)), as a resistor or a
capacitor carries it.
Implementations§
Source§impl Symbol
impl Symbol
Sourcepub fn default_value(&self) -> String
pub fn default_value(&self) -> String
The value a part placed from this symbol starts with: KiCad’s Value
property when the symbol carries one (R, LM358, Conn_01x04), else
the part of its library id after the :, which is what every component
was given before the property was read. The user’s value (10k) is typed
over it on the sheet; see Document::set_value.
Sourcepub fn gate_count(&self) -> u32
pub fn gate_count(&self) -> u32
How many gates the symbol is split into; 0 or 1 is a symbol drawn
whole.
Sourcepub fn migrate_legacy_units(&mut self) -> bool
pub fn migrate_legacy_units(&mut self) -> bool
Bring a multi-unit symbol written by the KiCad import BEFORE gates existed up to the gate shape, as a fresh import would write it now. Returns whether it changed anything.
That import put each KiCad unit into Pin::unit, which is the PORT
GROUP a pin binds into, set unit_count to the number of units, and
wrote a Unit N caption after each unit’s graphics. So an LM358 bound 3
of its 8 pins and was placed as one block. It is recognised by exactly
those captions: one Graphic::Text { text: "Unit N", size: 1270 } at
y == -15000 for every N in 1..=unit_count, in order, with every pin’s
unit in that range and no gate tagged yet. Nothing else wrote them, and
a part split into connectors on purpose (two headers, Pin::unit 1 and
2) has no such captions and is left alone.
Each unit becomes a gate: Pin::gate takes the unit and Pin::unit
goes back to 0, a graphic takes the gate of the caption that closes
its run, the captions go (a sheet names each gate U1A itself), and
unit_count becomes 1. Coordinates are not touched.
Sourcepub fn graphic_gate(&self, index: usize) -> u32
pub fn graphic_gate(&self, index: usize) -> u32
The gate graphic index is drawn with; 0 for none.