Terminal

class photonforge.Terminal(routing_layer, structure)

Electrical terminal.

Parameters:
  • routing_layer (str | tuple[int, int]) – Layer used when routing from this terminal.

  • structure (Rectangle | Circle | Polygong | Path) – Terminal shape used for connectivity check and routing.

Methods

bounds()

Calculate the terminal bounds

center()

Calculate the terminal center.

copy([deep])

Create a copy of this terminal.

mirror([axis_endpoint, axis_origin])

Mirror this terminal.

rotate(rotation[, center])

Rotate this terminal.

scale(scaling[, center])

Scale this terminal.

size()

Calculate the terminal size.

transform([translation, rotation, scaling, ...])

Apply a transformation to this terminal: self = translate(rotate(mirror(scale(self))))

translate(translation)

Translate this terminal.

Attributes

properties

Object properties.

routing_layer

Terminal routing layer.

structure

Terminal structure.

x_max

Upper bound in the x axis.

x_mid

Bounding box center in the x axis.

x_min

Lower bound in the x axis.

y_max

Upper bound in the y axis.

y_mid

Bounding box center in the y axis.

y_min

Lower bound in the y axis.

bounds()

Calculate the terminal bounds

Returns:

The lower-left and upper-right corners of the bounding box of the terminal: ((min_x, min_y), (max_x, max_y)).

Return type:

ndarray

center()

Calculate the terminal center.

Returns:

The center of the bounding box of the terminal.

Return type:

ndarray

copy(deep=False)

Create a copy of this terminal.

Parameters:

deep (bool) – If set, creates a deep copy.

Returns:

New copy.

Return type:

Terminal

mirror(axis_endpoint=(1, 0), axis_origin=(0, 0))

Mirror this terminal.

Parameters:
  • axis_endpoint (Sequence[float] | complex) – Mirror axis endpoint.

  • axis_origin (Sequence[float] | complex) – Mirror axis origin.

Returns:

This object.

Return type:

Terminal

properties

Object properties.

Type:

Properties

rotate(rotation, center=(0, 0))

Rotate this terminal.

Parameters:
  • rotation (float) – Rotation angle around the center (in degrees).

  • center (Sequence[float] | complex) – Center of rotation.

Returns:

This object.

Return type:

Terminal

routing_layer

Terminal routing layer.

Type:

tuple[int, int]

scale(scaling, center=(0, 0))

Scale this terminal.

Parameters:
  • scaling (float) – Magnification factor.

  • center (Sequence[float] | complex) – Center of scaling.

Returns:

This object.

Return type:

Terminal

size()

Calculate the terminal size.

Returns:

The size of the bounding box of the terminal.

Return type:

ndarray

structure

Terminal structure.

Type:

Rectangle | Circle | Polygon | Path

transform(translation=(0, 0), rotation=0, scaling=1, x_reflection=False)

Apply a transformation to this terminal: self = translate(rotate(mirror(scale(self))))

Parameters:
  • translation (Sequence[float] | complex) – Translation vector.

  • rotation (float) – Rotation angle (in degrees).

  • scaling (float) – Magnification factor.

  • x_reflection (bool) – Mirror across the horizontal axis.

Returns:

This object.

Return type:

Terminal

translate(translation)

Translate this terminal.

Parameters:

translation (Sequence[float] | complex) – Translation vector.

Returns:

This object.

Return type:

Terminal

x_max

Upper bound in the x axis.

Type:

float

x_mid

Bounding box center in the x axis.

Type:

float

x_min

Lower bound in the x axis.

Type:

float

y_max

Upper bound in the y axis.

Type:

float

y_mid

Bounding box center in the y axis.

Type:

float

y_min

Lower bound in the y axis.

Type:

float