feature module#

Feature definitions#

This module provides feature classes for representing board elements like cutouts, keepouts, silkscreen, and other board features. Notably, this does not include copper shapes, see the copper module for that.

class Feature(shape)[source]#

Bases: Critical

Base class for board features.

Parameters:

shape (Shape)

shape: Shape#

Shape of this feature.

invert()[source]#

Return a copy of this feature with the layers inverted.

Return type:

Self

class Cutout(shape)[source]#

Bases: Feature

Cutout element for holes and slots. Through-hole pads will include their hole definition using a Cutout.

>>> cutout = Cutout(Circle(radius=1.0))
Parameters:

shape (Shape)

class MultiLayerFeature(shape, layers)[source]#

Bases: Feature

Feature that spans multiple board layers.

Parameters:
layers: LayerSet#

The set of layers this feature applies to.

invert()[source]#

Return a copy of this feature with the layers inverted.

Return type:

Self

class KeepOut(shape, layers, *, pour=False, via=False, route=False)[source]#

Bases: MultiLayerFeature

Construct keepout regions on a range of layers.

>>> # Keep out pours and vias on the top layer
>>> keepout = KeepOut(layers=LayerSet(0), pour=True, via=True, route=False)
Parameters:
pour: bool = False#

Keep pours from covering this area.

via: bool = False#

Avoid auto-placing vias in this area.

route: bool = False#

Disallow auto-router traces in this area.

class SurfaceFeature(shape, side=Side.Top)[source]#

Bases: Feature

Surface features are features that apply to either top or bottom side of the board, but not to internal layers. This class should not be used directly, instead use one of the subclasses.

Parameters:
side: Side = 0#

Side of this surface feature. Note that a “bottom” side simply means the opposite side of where the landpattern / module it’s associated with is placed, and not necessarily the bottom side.

invert()[source]#

Return a copy of this feature with the layers inverted.

Return type:

Self

class Silkscreen(shape, side=Side.Top)[source]#

Bases: SurfaceFeature

Add a shape to the silkscreen layer

>>> silkscreen = Silkscreen(rectangle(2, 3), side=Side.Bottom)
Parameters:
class Soldermask(shape, side=Side.Top)[source]#

Bases: SurfaceFeature

Add a shape to the solder mask layer

>>> soldermask = Soldermask(rectangle(2, 1), side=Side.Top)
Parameters:
class Paste(shape, side=Side.Top)[source]#

Bases: SurfaceFeature

Add a shape to the paste application layer

>>> paste = Paste(circle(diameter=1))
Parameters:
class Glue(shape, side=Side.Top)[source]#

Bases: SurfaceFeature

Add a shape to the glue application layer

>>> glue = Glue(circle(diameter=1), side=Side.Bottom)
Parameters:
class Finish(shape, side=Side.Top)[source]#

Bases: SurfaceFeature

Add a shape to the glue application layer

>>> finish = Finish(rectangle(1, 1))
Parameters:
class Courtyard(shape, side=Side.Top)[source]#

Bases: SurfaceFeature

Courtyards are used to indicate land pattern bounds.

>>> courtyard = Courtyard(rectangle(3, 3))
Parameters:
class Custom(shape, side=Side.Top, *, name)[source]#

Bases: SurfaceFeature

Custom surface feature with user-defined name.

>>> custom = Custom(rectangle(2, 2), name="Fab")
Parameters:
name: str#

Name of the custom feature layer.