pub struct Component {
pub id: Uuid,
pub reference: String,
pub value: String,
pub symbol: Symbol,
pub at: Point,
pub rotation: u8,
pub part: Option<PartSource>,
pub pads: Option<Footprint>,
pub gates: Vec<GatePlacement>,
}Fields§
§id: Uuid§reference: StringThe label this placed part goes by, such as J1. A host that keeps its own
labels sets it with Document::set_reference.
value: String§symbol: Symbol§at: Point§rotation: u8§part: Option<PartSource>The part this was placed from, absent for a component drawn without one.
pads: Option<Footprint>The part’s board pads, copied when it was placed.
gates: Vec<GatePlacement>Where each gate of a symbol split into gates (Pin::gate) sits on the
sheet, one entry per gate: each is moved and turned on its own and named
by the reference and its letter (U1A), while the component stays ONE
part with one reference, one set of pads and one board placement. Empty,
and omitted, for a symbol drawn whole.
Implementations§
Source§impl Component
impl Component
Sourcepub fn is_valued_part(&self) -> bool
pub fn is_valued_part(&self) -> bool
Whether this is a part with a value of its own: not a power symbol or flag
(a # reference, as KiCad’s #PWR and #FLG, which name a net and are left
out of the netlist and the BOM), and not a pinless placeholder.
pub fn transform(&self, p: Point) -> Point
Sourcepub fn gate_transform(&self, gate: u32, p: Point) -> Point
pub fn gate_transform(&self, gate: u32, p: Point) -> Point
Where a symbol point drawn with gate gate lands on the sheet: through
that gate’s own placement when the component has one, else through the
component’s.
Sourcepub fn gate(&self, gate: u32) -> Option<&GatePlacement>
pub fn gate(&self, gate: u32) -> Option<&GatePlacement>
The placement of gate gate, when the component places its gates apart.
Sourcepub fn graphic_transform(&self, index: usize, p: Point) -> Point
pub fn graphic_transform(&self, index: usize, p: Point) -> Point
Where a point of graphic index lands on the sheet.
Sourcepub fn gate_reference(&self, gate: u32) -> String
pub fn gate_reference(&self, gate: u32) -> String
The name a gate goes by on the sheet: U1A for gate 1 of U1; the
reference alone for a component drawn whole.
Sourcepub fn sheet_boxes(&self) -> Vec<(u32, Point, Point)>
pub fn sheet_boxes(&self) -> Vec<(u32, Point, Point)>
The boxes the component covers on the sheet, one for each gate placed apart, else one for the whole symbol.
Sourcepub fn sync_gates(&mut self)
pub fn sync_gates(&mut self)
Give the component one GatePlacement per gate of its symbol, keeping
those it has. A new gate starts exactly where the symbol drawn whole puts
it, so splitting moves nothing; a symbol drawn whole has none.