Records Classes

Attention

Record classes are accessed internally using component classes. This page is only for documentation purposes.

Schematic Records

Generic Schematic Record

class pyaltiumlib.schlib.records.base.GenericSchRecord(data: Dict[str, Any], parent: [Any] = None)

Base class for all schematic records in altium library. See also Schematic Record and Schematic Common Parameter for more details on schematic records.

Parameters:
  • data (Dict) – Dictionary containing raw record data

  • parent (class) – Parent symbol object

__repr__() str
Returns:

A string representation of the record object

Return type:

str

draw_bounding_box(graphic, offset: CoordinatePoint, zoom: float) None

This function is triggered when the draw_bbox parameter is set in pyaltiumlib.libcomponent.LibComponent.draw_svg.

Draws a bounding box using the values given by get_bounding_box for each record

get_svg_arc_path(center, radius_x, radius_y, angle_start, angle_end) str

This function returns the svg path data for an arc.

Parameters:
  • center (tuple) – The center coordinates of the arc

  • radius_x (int) – The x-radius of the arc

  • radius_y (int) – The y-radius of the arc

  • angle_start (float) – The start angle of the arc

  • angle_end (float) – The end angle of the arc.

Returns:

corresponding svg path data for arc

Return type:

str

get_svg_stroke_dasharray() str

This function returns the svg attribute stroke-dasharray for the given linestyle.

For more information on how stroke-dasharray works, visit the MDN Web Docs for stroke-dasharray.

Returns:

corresponding svg attribute stroke-dasharray

Return type:

str

SchComponent

class pyaltiumlib.schlib.records.SchComponent.SchComponent(data, parent)

Bases: GenericSchRecord

Implementation of a schematic record See also ID 1 - Component details on this schematic records.

Parameters:
  • data (Dict) – Dictionary containing raw record data

  • parent (class) – Parent symbol object

Raises:

ValueError – If record id is not valid

SchPin

class pyaltiumlib.schlib.records.SchPin.SchPin(data, parent)

Bases: GenericSchRecord

Implementation of a schematic record See also ID 2 - Pin details on this schematic records. This record can be drawn.

Parameters:
  • data (Dict) – Dictionary containing raw record data

  • parent (class) – Parent symbol object

Raises:

ValueError – If record id is not valid

draw_svg(dwg, offset, zoom) None

Draw schematic record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

SchLabel

class pyaltiumlib.schlib.records.SchLabel.SchLabel(data, parent)

Bases: GenericSchRecord

Implementation of a schematic record See also ID 4 - Label details on this schematic records. This record can be drawn.

Parameters:
  • data (Dict) – Dictionary containing raw record data

  • parent (class) – Parent symbol object

Raises:

ValueError – If record id is not valid

draw_svg(dwg, offset, zoom) None

Draw schematic record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

SchBezier

class pyaltiumlib.schlib.records.SchBezier.SchBezier(data, parent)

Bases: GenericSchRecord

Implementation of a schematic record See also ID 5 - Bezier details on this schematic records. This record can be drawn.

Parameters:
  • data (Dict) – Dictionary containing raw record data

  • parent (class) – Parent symbol object

Raises:

ValueError – If record id is not valid

classmethod bezier_interpolate(control_points, steps=20) List

Interpolate points along a Bezier curve before using De Casteljau’s algorithm.

Parameters:
  • control_points (List[tuple]) – The control points of the Bezier curve.

  • steps (int optional) – The number of steps for interpolation.

Returns:

The interpolated points along the Bezier curve

Return type:

List[tuple]

draw_svg(dwg, offset, zoom) None

Draw schematic record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

SchPolyline

class pyaltiumlib.schlib.records.SchPolyline.SchPolyline(data, parent)

Bases: GenericSchRecord

Implementation of a schematic record See also ID 6 - Polyline details on this schematic records. This record can be drawn.

Parameters:
  • data (Dict) – Dictionary containing raw record data

  • parent (class) – Parent symbol object

Raises:

ValueError – If record id is not valid

draw_svg(dwg, offset, zoom) None

Draw schematic record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

SchPolygon

class pyaltiumlib.schlib.records.SchPolygon.SchPolygon(data, parent)

Bases: GenericSchRecord

Implementation of a schematic record See also ID 7 - Polygon details on this schematic records. This record can be drawn.

Parameters:
  • data (Dict) – Dictionary containing raw record data

  • parent (class) – Parent symbol object

Raises:

ValueError – If record id is not valid

draw_svg(dwg, offset: CoordinatePoint, zoom: float) None

Draw schematic record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

SchEllipse

class pyaltiumlib.schlib.records.SchEllipse.SchEllipse(data, parent)

Bases: GenericSchRecord

Implementation of a schematic record See also ID 8 - Ellipse details on this schematic records. This record can be drawn.

Parameters:
  • data (Dict) – Dictionary containing raw record data

  • parent (class) – Parent symbol object

Raises:

ValueError – If record id is not valid

draw_svg(dwg, offset, zoom) None

Draw schematic record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

SchRoundRectangle

class pyaltiumlib.schlib.records.SchRoundRectangle.SchRoundRectangle(data, parent)

Bases: GenericSchRecord

Implementation of a schematic record See also ID 10 - Rounded Rectangle details on this schematic records. This record can be drawn.

Parameters:
  • data (Dict) – Dictionary containing raw record data

  • parent (class) – Parent symbol object

Raises:

ValueError – If record id is not valid

draw_svg(dwg, offset, zoom) None

Draw schematic record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

SchEllipticalArc

class pyaltiumlib.schlib.records.SchEllipticalArc.SchEllipticalArc(data, parent)

Bases: GenericSchRecord

Implementation of a schematic record See also ID 11 - Elliptical Arc details on this schematic records. This record can be drawn.

Parameters:
  • data (Dict) – Dictionary containing raw record data

  • parent (class) – Parent symbol object

Raises:

ValueError – If record id is not valid

draw_svg(dwg, offset, zoom) None

Draw schematic record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

SchArc

class pyaltiumlib.schlib.records.SchArc.SchArc(data, parent)

Bases: GenericSchRecord

Implementation of a schematic record See also ID 12 - Arc details on this schematic records. This record can be drawn.

Parameters:
  • data (Dict) – Dictionary containing raw record data

  • parent (class) – Parent symbol object

Raises:

ValueError – If record id is not valid

draw_svg(dwg, offset, zoom) None

Draw schematic record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

SchLine

class pyaltiumlib.schlib.records.SchLine.SchLine(data, parent)

Bases: GenericSchRecord

Implementation of a schematic record See also ID 13 - Line details on this schematic records. This record can be drawn.

Parameters:
  • data (Dict) – Dictionary containing raw record data

  • parent (class) – Parent symbol object

Raises:

ValueError – If record id is not valid

draw_svg(dwg, offset, zoom) None

Draw schematic record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

SchRectangle

class pyaltiumlib.schlib.records.SchRectangle.SchRectangle(data, parent)

Bases: GenericSchRecord

Implementation of a schematic record See also ID 14 - Rectangle details on this schematic records. This record can be drawn.

Parameters:
  • data (Dict) – Dictionary containing raw record data

  • parent (class) – Parent symbol object

Raises:

ValueError – If record id is not valid

draw_svg(dwg, offset, zoom) None

Draw schematic record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

SchDesignator

class pyaltiumlib.schlib.records.SchDesignator.SchDesignator(data, parent)

Bases: GenericSchRecord

Implementation of a schematic record See also ID 34 - Designator details on this schematic records. This record can be drawn if not excluded.

Parameters:
  • data (Dict) – Dictionary containing raw record data

  • parent (class) – Parent symbol object

Raises:

ValueError – If record id is not valid

draw_svg(dwg, offset, zoom) None

Draw schematic record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

SchParameter

class pyaltiumlib.schlib.records.SchParameter.SchParameter(data, parent)

Bases: GenericSchRecord

Implementation of a schematic record See also ID 41 - Parameter details on this schematic records.

Parameters:
  • data (Dict) – Dictionary containing raw record data

  • parent (class) – Parent symbol object

Raises:

ValueError – If record id is not valid

PCB Records

Generic PCB Record

class pyaltiumlib.pcblib.records.base.GenericPCBRecord(parent)

Base class for all PCB records in altium library. See also PCB Primitive Header for more details on PCB records.

Parameters:

parent (class) – Parent symbol object

__repr__() str
Returns:

A string representation of the record object

Return type:

str

draw_bounding_box(graphic, offset: CoordinatePoint, zoom: float) None

This function is triggered when the draw_bbox parameter is set in pyaltiumlib.libcomponent.LibComponent.draw_svg.

Draws a bounding box using the values given by get_bounding_box for each record

get_layer_by_id(layerid)

Retrieves the layer by the layer id given by the reocrd.

Returns:

The record ID, or None if not found.

Return type:

Layer or None

get_svg_arc_path(center, radius_x, radius_y, angle_start, angle_end)

This function returns the svg path data for an arc.

Parameters:
  • center (tuple) – The center coordinates of the arc

  • radius_x (int) – The x-radius of the arc

  • radius_y (int) – The y-radius of the arc

  • angle_start (float) – The start angle of the arc

  • angle_end (float) – The end angle of the arc.

Returns:

corresponding svg path data for arc

get_svg_keepout_pattern(graphic, layer_id, size=10, stroke=1) None

This function returns and defines the svg keep out pattern.

Parameters:
  • dwg (graphic) – svg drawing object

  • layer_id (int) – The layer id of the object

  • size (int) – The size of the pattern

  • stroke (int) – The stroke of the pattern

Draws a bounding box using the values given by get_bounding_box for each record

get_svg_rounded_rect_path(start, size, layer_id, radius_percentage=100)

This function returns the svg path data for a rounded rectangle.

Parameters:
  • start (CoordinatePoint) – The start coordinates of the rounded rectangle

  • size (CoordinatePoint) – The size coordinates of the rounded rectangle

  • layer_id (int) – The layer id of the rounded rectangle

  • radius_percentage (float) – The start angle of the arc

Returns:

corresponding svg path data for arc

read_common(byte_array)

Read PCB Record common parameters from byte array. The length of the byte array has to be 13 bytes.

Parameters:

byte_array (bytes) – Array with common parameters for footprint records

PcbArc

class pyaltiumlib.pcblib.records.PCBArc.PcbArc(parent, stream)

Bases: GenericPCBRecord

Implementation of a pcb record See also ID 1 - Arc details on this PCB records. This record can be drawn.

Parameters:
  • parent (class) – Parent symbol object

  • data (Dict) – Dictionary containing raw record data

draw_svg(dwg, offset, zoom) None

Draw pcb record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

PcbVia

class pyaltiumlib.pcblib.records.PCBVia.PcbVia(parent, stream)

Bases: GenericPCBRecord

Implementation of a pcb record See also ID 3 - Via details on this PCB records. This record can be drawn.

Parameters:
  • parent (class) – Parent symbol object

  • data (Dict) – Dictionary containing raw record data

draw_svg(dwg, offset, zoom) None

Draw pcb record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

PcbPad

class pyaltiumlib.pcblib.records.PCBPad.PcbPad(parent, stream)

Bases: GenericPCBRecord

Implementation of a pcb record See also ID 2 - Pad details on this PCB records. This record can be drawn.

Parameters:
  • parent (class) – Parent symbol object

  • data (Dict) – Dictionary containing raw record data

draw_svg(dwg, offset, zoom) None

Draw pcb record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

PcbTrack

class pyaltiumlib.pcblib.records.PCBTrack.PcbTrack(parent, stream)

Bases: GenericPCBRecord

Implementation of a pcb record See also ID 4 - Track details on this PCB records. This record can be drawn.

Parameters:
  • parent (class) – Parent symbol object

  • data (Dict) – Dictionary containing raw record data

draw_svg(dwg, offset, zoom) None

Draw pcb record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

PcbString

class pyaltiumlib.pcblib.records.PCBString.PcbString(parent, stream)

Bases: GenericPCBRecord

Implementation of a pcb record See also ID 5 - String details on this PCB records. This record can be drawn.

Parameters:
  • parent (class) – Parent symbol object

  • data (Dict) – Dictionary containing raw record data

draw_svg(dwg, offset, zoom) None

Draw pcb record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

PcbFill

class pyaltiumlib.pcblib.records.PCBFill.PcbFill(parent, stream)

Bases: GenericPCBRecord

Implementation of a pcb record See also ID 6 - Fill details on this PCB records. This record can be drawn.

Parameters:
  • parent (class) – Parent symbol object

  • data (Dict) – Dictionary containing raw record data

draw_svg(dwg, offset, zoom) None

Draw pcb record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

PcbRegion

class pyaltiumlib.pcblib.records.PCBRegion.PcbRegion(parent, stream)

Bases: GenericPCBRecord

Implementation of a pcb record See also ID 11 - Region details on this PCB records. This record can be drawn.

Parameters:
  • parent (class) – Parent symbol object

  • data (Dict) – Dictionary containing raw record data

draw_svg(dwg, offset, zoom) None

Draw pcb record using svgwrite.

Parameters:
  • dwg (graphic) – svg drawing object

  • offset (CoordinatePoint) – Move drawing by the given offset as Coordinate Point

  • zoom (float) – Scaling Factor for all elements

get_bounding_box() Tuple[CoordinatePoint, CoordinatePoint]

Generates and returns a bounding box for this record

Returns:

List with two coordinate entries

Return type:

tuple with Coordinate Point

PcbComponentBody

class pyaltiumlib.pcblib.records.PCBComponentBody.PcbComponentBody(parent, stream)

Bases: GenericPCBRecord

Implementation of a pcb record See also ID 12 - Component Body details on this PCB records. This record can be drawn.

Parameters:
  • parent (class) – Parent symbol object

  • data (Dict) – Dictionary containing raw record data