pcb_set_mech_layer_kind
Assigns a purpose kind to a PCB mechanical layer so courtyard, assembly, 3D, and via treatments use it; supports paired Top/Bottom kinds and clears conflicting single-kind assignments.
Instructions
Set what a mechanical layer is FOR, not what it is called.
Renaming a layer "Courtyard Top" does not make it one. The KIND is a separate property, and it is what every feature resolving a layer by purpose reads: courtyard checking, assembly drawings, 3D body placement and the IPC-4761 via treatments. A layer with no kind is skipped by all of them, so the outlines get drawn and nothing uses them.
A SINGLE kind such as "Fab Notes" belongs to ONE layer at a time.
If another layer already holds it, that layer is cleared first and
named in cleared_from, because leaving two layers claiming one
purpose is a state the stack manager does not intend.
A PAIRED kind, meaning any name ending in Top or Bottom, works
differently: it is held by the layer PAIR rather than by either
layer, under a separate set of names with the side dropped. So
"Courtyard Top" is stored as the pair kind "Courtyard" across the
two layers, and partner_layer is required to say which layer
carries the other side. Writing it without a partner is refused
rather than silently doing nothing.
The write is READ BACK before reporting success. A refused assignment raises nothing here, so trusting it would report success for having changed nothing.
Args:
layer: Mechanical layer, e.g. "Mechanical13".
kind: A kind name such as "Courtyard Top", "Assembly Top",
"3D Body Top", "Component Outline Top", "Fab Notes" or
"Not Set". A bare number is also accepted, so a kind added
by a later Altium release can be set without waiting for
the name map to catch up. Read the current assignment with
pcb_get_mech_layer_names.
partner_layer: The mechanical layer carrying the other side,
required when kind ends in Top or Bottom and ignored
otherwise. The two layers are joined as a pair, which is
what the kind is then written to.
Returns:
Dict with layer, kind, kind_id, paired,
pair_kind, partner_layer and cleared_from.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| kind | Yes | ||
| layer | Yes | ||
| partner_layer | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||