Component Classes

Generic Component (Base)

class pyaltiumlib.libcomponent.LibComponent(parent, name: str, description: str)

Bases: object

Base class represent a basic component Altium Designer library files.

This class provides fundamental functionality for reading and illustrating Altium Designer components

Parameters:
  • parent (class) – reference to library file pyaltiumlib.schlib.lib.SchLib or pyaltiumlib.pcblib.lib.PcbLib

  • name (string) – name of the component

  • description (string) – description of the component

Description

string that contains the description of the component

LibFile

class that references to library file

Name

string that contains the name of the component

Records

List[any] is a collection of records in their specific class contained in the library.

__repr__() str

Converts name and descirption to a string.

Returns:

A string representation of the object

Return type:

str

draw_svg(graphic, size_x: float, size_y: float, draw_bbox: bool = False, draw_designator: bool = False) None

Draw all drawable and initialized records the component to an svg drawing. All records are autoscaled to fit the given drawing object size.

Parameters:
  • graphic (svgwrite.Drawing) – the svgwrite drawing object

  • size_x (float) – The width of the svgwrite drawing object

  • size_y (float) – The height of the svgwrite drawing object

  • draw_bbox (bool optional) – Draw bounding boxes

  • draw_designator (bool optional) – Draw designator elements

Raises:
  • ImportError – If ‘svgwrite’ module is not installed.

  • ValueError – If ‘graphic’ is not the right instance.

read_meta() Dict

Converts name and descirption to a dictionary.

Returns:

A dict representation of the object

Return type:

Dict

Schematic Symbol Component

class pyaltiumlib.schlib.symbol.SchLibSymbol(parent, name: str, description: str = '', partcount: int = 0)

Bases: LibComponent

Symbol class represent a schematic symbol in an Altium Schematic Library. During initialization the library file will be read.

Parameters:
  • parent (class) – reference to library file pyaltiumlib.schlib.lib.SchLib

  • name (string) – name of the component

  • description (string optional) – description of the component

  • partcount (int optional) – number of parts in the symbol

Raises:
  • ValueError – If record id is not valid

  • ValueError – If component data can not be read

Designator

str designator of symbol

Parameter

Dict[str] of parameters of the symbol

PartCount

int number of sub parts within one symbol

read_meta() Dict

Converts general properties to a dictionary.

Returns:

A dict representation of the object

Return type:

Dict

PCB Footprint Component

class pyaltiumlib.pcblib.footprint.PcbLibFootprint(parent, name, description='')

Bases: LibComponent

Footprint class represent a PCB footprint in an Altium Schematic Library. During initialization the library file will be read.

Parameters:
  • parent (class) – reference to library file pyaltiumlib.schlib.lib.PCBLib

  • name (string) – name of the component

  • description (string optional) – description of the component

Raises:
  • ValueError – If record id is not valid

  • ValueError – If component data can not be read