preferred-orientation

The preferred-orientation statement is used to as a hint to the schematic layout engine. It provides a set of preferred orientations of this symbol. The layout optimization engine will then try its best to keep the symbols oriented in those directions.

Signature

  preferred-orientation = <SymbolOrientation>

The &lt;SymbolOrientation> is an instance of type SymbolOrientation. There are two derived types for SymbolOrientation in the JITX runtime:

  • AnyRotation() - This tells the schematic layout engine that there is no preferred orientation for this component.
  • PreferRotation(rotations:Tuple<Int>) - This allows you to specify one of four standard orientations for the schematic symbol.
  • Rotation Mapping:
    • 0 =>
    • 1 => 90°
    • 2 => 180°
    • 3 => 270°
  • Rotation Relationship: 90° * i
  • Each rotation is counter-clockwise around the Z-axis
  • The values 0 through 3 are the only accepted values.

Usage

There are many uses for this functionality, but the motivating use case is for net symbols like ground and power symbols:

public pcb-symbol altium-ground-sym :
  name = "POWER-GROUND"
  pin p[0] at unit-point(0.0, 0.0)

  unit-line([[0.0, 0.0], [2.54, 0.0]])
  unit-line(0.1, [[2.54, -1.4], [2.54, 1.4]])
  unit-line(0.1, [[3.81 -0.93], [3.81, 0.93]])
  unit-line(0.1, [[5.08, -0.46], [5.08, 0.46]])
  unit-val([7.5, -2.5])

  preferred-orientation = PreferRotation([3])

The PreferRotation([3]) results in the following preferred orientation:

Preferred Rotation

Note that this rotation is about the origin in the pcb-symbol frame of reference.