pyaltium#

__init__.py

Subpackages#

Submodules#

Package Contents#

Classes#

MaterialsLibrary

The top level materials library item.

PcbLib

Main object to interact with PCBLib

PcbLibItem

Single item in a library.

SchLib

Main object to interact with schematic libraries.

SchLibItem

A single schematic item in a library.

class pyaltium.MaterialsLibrary(library_id=None, serializer_version='1.1.0.0', version='1.1.0.0', namespace='http://altium.com/ns/Data/ExtensibleLibraries')#

The top level materials library item.

This class represents an Altium materials library, which is generally

Parameters:
  • library_id (Union[str, uuid.UUID]) –

  • serializer_version (str) –

  • version (str) –

  • namespace (str) –

types: list#
type_extensions: list#
entities: list[pyaltium.matlib.base.MatLibEntity]#
entity_extensions: list#
serializer_version: str#
library_id: uuid.UUID#
version: str#
namespace: str#
classmethod from_et(et)#

Load in a XML document root as parameters and entities.

Parameters:

et (xml.etree.ElementTree.Element) –

Return type:

MaterialsLibrary

getall(obj_type)#

Locate all

Parameters:

obj_type (Union[pyaltium.matlib.base.MatLibEntity, tuple[pyaltium.matlib.base.MatLibEntity]]) –

Return type:

Iterable[pyaltium.matlib.base.MatLibEntity]

classmethod loads(s)#

Read in the material library from an XML string.

classmethod load(file)#

Read this library from an XML file.

Parameters:

file (Union[TextIO, str]) – File name as string or pointer as an IO type. Passed directly to

xml.etree.ElementTree.ElementTree.parse(). :type file: Union[TextIO, str]

dumps()#

Write this material library to an XML string.

Return type:

str

dump(file)#

Write this library to a file as XML.

Parameters:

file (Union[TextIO, str]) – File name as string or pointer as an IO type. Passed directly to

xml.etree.ElementTree.ElementTree.write(). :type file: Union[TextIO, str]

class pyaltium.PcbLib(file_name=None, lazyload=False)#

Bases: pyaltium.base.AltiumLibMixin[PcbLibItem]

Main object to interact with PCBLib

Parameters:
  • file_name (str) –

  • lazyload (bool) –

class pyaltium.PcbLibItem(footprintref, description, height, file_name)#

Bases: pyaltium.base.AltiumLibItemMixin

Single item in a library.

Parameters:
  • footprintref (str) –

  • description (str) –

  • height (float) –

  • file_name (str) –

as_dict()#

Create a parsable dict.

Return type:

dict

class pyaltium.SchLib(file_name=None, lazyload=False)#

Bases: pyaltium.base.AltiumLibMixin[pyaltium.sch._item.SchLibItem]

Main object to interact with schematic libraries.

Parameters:
  • file_name (str) –

  • lazyload (bool) –

class pyaltium.SchLibItem(libref, sectionkey, description, partcount, file_name, lazyload=False)#

Bases: pyaltium.base.AltiumLibItemMixin[pyaltium.sch._record.SchLibItemRecord]

A single schematic item in a library.

Parameters:
  • AltiumLibItemMixin ([type]) – [description]

  • libref (str) –

  • sectionkey (str) –

  • description (str) –

  • partcount (int) –

  • file_name (str) –

  • lazyload (bool) –

libref: str#
sectionkey: str#
description: str#
partcount: int#
lazyload: bool#
file_name: str#
draw(ax)#

Create the drawing on the axes

Parameters:

ax (matplotlib.pyplot.Axes) –

Return type:

None

as_dict()#

Create a parsable dict.

Return type:

dict