component module#
Component definitions#
This modules provides the Component class, which represents a physical component
in a design, contains meta information about the component itself, and links
ports to landpatterns and symbols.
- class Component[source]#
Bases:
PositionableComponents are a structural element in JITX representing a physical component. Components are instantiated in a
Circuitand contain a landpattern and a symbol, as well asPortobjects that are mapped to landpattern pads and symbol pins.- Valid elements in a component are:
Note that if multiple landpatterns are specified, they will be combined into a single composite landpattern. Multiple symbols are permissible, and will end up in the schematic as independent symbols units.
If there are no pad mappings, a default mapping will be created that maps ports to pads in order. Similarly if there are no symbol mappings, a default mapping will be created that will attempt to map all ports to symbol pins in order. If a port should have no pad mapping, or multiple pads need to mapped to a single port, a pad mapping must be explicitly created.
>>> class MyComponent(Component): ... VIN = Power() ... aux = Port() ... ... landpattern = MyLandpattern() ... symbol = BoxSymbol() ... def __init__(self): ... self.mappings = [ ... PadMapping({ ... self.VIN.Vp: self.landpattern.p[1], ... self.VIN.Vn: self.landpattern.p[2], ... self.aux: self.landpattern.p[3], ... }), ... SymbolMapping({ ... self.VIN.Vp: self.symbol.power, ... self.VIN.Vn: self.symbol.ground, ... self.aux: self.symbol.data, ... }), ... ]
It is perfectly valid to have a component definition that constructs the component dynamically given parameters. For example you could have a component class that reads a CSV file to generate the component’s properties.
- value: str | PlainQuantity | None = None#
Value label string for this component.
- mpn: str | None = None#
Manufacturer part number for this component.
- manufacturer: str | None = None#
Manufacturer for this component.
- reference_designator: str | None = None#
Reference designator for this component. Note that this field should probably be left blank until after the component has been instantiated, or it will be the same (and thus trigger an error) for every component of the same type.
- reference_designator_prefix: str | None = None#
Reference designator prefix for this component. This will be used to generate a unique reference designator for each component of the same type.
Note
This field is a required data point for matching components between builds. If this value changes (including changing from unset to set), it will be treated as a new component, even if nothing else changes.
- in_bom: bool | None = None#
Whether this component is in the bill of materials. If unset, defers to the parent
Circuit’sin_bomattribute. If a component is not in the bill of materials, then it can be considered to be non-populated.
- soldered: bool | None = None#
Whether this component is soldered on the board. If unset, defers to the parent
Circuit’ssolderedattribute. If a component is not soldered on the board but in the bill of materials, then it can be considered to a component that is orderable such as a jumper, screw or other mechanical components but not attached via a standard soldering process.
- schematic_x_out: bool | None = None#
Whether this component is marked with a red X in the schematic. If unset, defers to the parent
Circuit’sschematic_x_outattribute. Enabling the red X on the component in the schematic can indicate that component should be treated differently (e.g. not in the bill of materials or not soldered depending on the state of the other flags). ::note
- class MechanicalComponent(*args, **kwargs)[source]#
Bases:
ComponentThis is a subclass of
Componentthat is used to represent mechanical components that are not in the bill of materials and are not soldered on the board.- in_bom: bool | None = False#
Whether this component is in the bill of materials. If unset, defers to the parent
Circuit’sin_bomattribute. If a component is not in the bill of materials, then it can be considered to be non-populated.
- soldered: bool | None = False#
Whether this component is soldered on the board. If unset, defers to the parent
Circuit’ssolderedattribute. If a component is not soldered on the board but in the bill of materials, then it can be considered to a component that is orderable such as a jumper, screw or other mechanical components but not attached via a standard soldering process.
- class NonSolderedComponent(*args, **kwargs)[source]#
Bases:
ComponentThis is a subclass of
Componentthat is used to represent components that are present in the bill of materials but are not soldered on the board.- in_bom: bool | None = True#
Whether this component is in the bill of materials. If unset, defers to the parent
Circuit’sin_bomattribute. If a component is not in the bill of materials, then it can be considered to be non-populated.
- soldered: bool | None = False#
Whether this component is soldered on the board. If unset, defers to the parent
Circuit’ssolderedattribute. If a component is not soldered on the board but in the bill of materials, then it can be considered to a component that is orderable such as a jumper, screw or other mechanical components but not attached via a standard soldering process.
- class NonPopulatedComponent(*args, **kwargs)[source]#
Bases:
ComponentThis is a subclass of
Componentthat is used to represent circuit components that are not present in the bill of materials and are also not soldered on the board but the landpattern is present on the board.Note
This component status is commonly referred to as do-not-populate (DNP) or not-populated (NP).
- in_bom: bool | None = False#
Whether this component is in the bill of materials. If unset, defers to the parent
Circuit’sin_bomattribute. If a component is not in the bill of materials, then it can be considered to be non-populated.
- soldered: bool | None = False#
Whether this component is soldered on the board. If unset, defers to the parent
Circuit’ssolderedattribute. If a component is not soldered on the board but in the bill of materials, then it can be considered to a component that is orderable such as a jumper, screw or other mechanical components but not attached via a standard soldering process.
- class CurrentComponent(component)[source]#
Bases:
ContextContext object representing the currently active component during processing. Should not be used directly, but rather accessed through
jitx.current’scomponentinstead.>>> def get_component_ports() -> list[Port]: ... component = jitx.current.component ... ports = extract(component, Port) ... return list(ports)
- Parameters:
component (Component)