backend-substitution¶
The backend-substitution
statement is used to customize the symbol generation when exported to a particular backend, like Kicad or Altium.
This
backend-substitution
statement is primarily useful for net symbols like the ground
symbol or the power arrow symbol. Certain backends have a restricted set of net symbols that can be created in these cases. This statement allows the user to customize which
symbol will be used on these backends.
Altium ground and supply symbols are in the ocdb/utils/symbols package of the open-components-database repository.
Signature¶
backend-substitution(<String>) = <SchematicSymbol>
...
<String>
- A string literal for the backend this statement targets.- "Altium" targets "Altium Designer" export
- "Kicad" targets "Kicad" export.
<SchematicSymbol>
- A schematic symbol definition created using thepcb-symbol
statement.
Usage¶
For certain symbols, we might want to customize the symbol construction depending on the backend (ie, the export target).
public pcb-symbol ground-sym :
pin p[0] at unit-point(0.0, 0.0)
unit-line([[0.0, 0.0], [0.0, -0.5]])
unit-line(0.1, [[-0.5, -0.5], [0.5, -0.5]])
unit-line(0.1, [[-0.3, -0.7], [0.3, -0.7]])
unit-line(0.1, [[-0.1, -0.9], [0.1, -0.9]])
unit-val([-1.0, -1.5])
preferred-orientation = PreferRotation([0])
backend-substitution("Altium") = altium-power-gnd-power-sym
Here the default symbol geometry gets created on all platforms except Altium, which gets a customized Power Port Symbol, specifically, the "Power Ground" symbol.
The backend gets selected with the set-export-backend function. The backend gets selected with the set-export-backend function.