IPCB_MechanicalLayerPairs interface
The mechanical layer pairs of a PCB document, each pair linking two mechanical layers as counterparts on the two sides of the board.
public interface IPCB_MechanicalLayerPairs
Namespace: PCB · Assembly: Altium.SDK.Interfaces
Remarks
The collection is the IPCB_Board.MechanicalPairs property.
When a component is flipped to the other side of the board, its objects on a paired mechanical layer move to the other layer of the pair, as objects on the top and bottom copper, overlay, paste mask and solder mask layers do.
Count returns the number of pairs; LayerPair returns the pair at an index from 0 to Count - 1 as a MechanicalLayerPair with the two layers of the pair.
Properties
| Property | Type | Access | Description |
|---|---|---|---|
| LayerPair | MechanicalLayerPair | get | The pair at the given index, as a MechanicalLayerPair with the two layers of the pair. |
| LayerPairKind | TMechanicalLayerPairKind | get; set | The kind of the pair at the given index, such as assembly, courtyard or 3D body. |
LayerPair
The pair at the given index, as a MechanicalLayerPair with the two layers of the pair.
MechanicalLayerPair GetState_LayerPair(int argI);
Type: MechanicalLayerPair · Access: read-only · Index: argI (int)
The accessors are extension methods of IPCB_MechanicalLayerPairsHelper (using PCB;).
For an index outside 0 to Count - 1, both layers of the returned pair are no layer.
LayerPairKind
The kind of the pair at the given index, such as assembly, courtyard or 3D body.
TMechanicalLayerPairKind GetState_LayerPairKind(int argI);
void SetState_LayerPairKind(int argI, TMechanicalLayerPairKind argKind);
Type: TMechanicalLayerPairKind · Access: read/write · Index: argI (int)
The accessors are extension methods of IPCB_MechanicalLayerPairsHelper (using PCB;).
Reading returns the kind shared by both layers of the pair, and TMechanicalLayerPairKind.mlpUndefined when the two layers have different kinds or the index is out of range. Assigning a kind changes the kinds of both layers and updates their names. Unless the board uses additional rigid-flex layers, the assignment does nothing when the board already has a mechanical layer of either layer kind that the pair kind uses.
Methods
| Method | Returns | Description |
|---|---|---|
| AddPair | int | Adds a pair of two mechanical layers and returns the index of the new pair. |
| Clear | void | Removes all pairs from the collection. |
| Count | int | Returns the number of mechanical layer pairs. |
| CreatePairByKind | int | Adds two new mechanical layers of the given pair kind to the board, pairs them, and returns the index of the new pair. |
| Export_ToParameters | void | Writes all pairs into a parameter string. |
| FlipLayer | bool | Replaces a mechanical layer with the other layer of its pair. |
| FlipLayerV7 | bool | Replaces a mechanical layer with the other layer of its pair; returns true when the layer was replaced. |
| Import_FromParameters | void | Replaces all pairs with the pairs read from a parameter string. |
| LayerUsed | bool | Returns whether the given layer belongs to any pair. |
| PairDefined | bool | Returns whether a pair of the two given layers exists, in either order. |
| RemovePair | bool | Removes the pair of the two given layers, given in either order; returns true when a pair was removed. |
AddPair
Adds a pair of two mechanical layers and returns the index of the new pair.
int AddPair(V7_LayerBase argLayer1, V7_LayerBase argLayer2);
int AddPair(IV7_Layer argLayer1, IV7_Layer argLayer2);
| Parameter | Type | Passing |
|---|---|---|
argLayer1 | V7_LayerBase | value |
argLayer2 | V7_LayerBase | value |
Returns: int
The first overload is an extension method of IPCB_MechanicalLayerPairsHelper (using PCB;) with typed parameters; the second is declared by the interface.
Returns -1 and adds nothing when either layer is not a mechanical layer. The pair is added even when the same pair is already defined; use PairDefined to check first.
Clear
Removes all pairs from the collection.
void Clear();
Returns: nothing (void)
Count
Returns the number of mechanical layer pairs.
int Count();
Returns: int
CreatePairByKind
Adds two new mechanical layers of the given pair kind to the board, pairs them, and returns the index of the new pair.
int CreatePairByKind(TMechanicalLayerPairKind argKind);
int CreatePairByKind(int argKind);
| Parameter | Type | Passing |
|---|---|---|
argKind | TMechanicalLayerPairKind | value |
Returns: int
The first overload is an extension method of IPCB_MechanicalLayerPairsHelper (using PCB;) with typed parameters; the second is declared by the interface.
For a kind other than TMechanicalLayerPairKind.mlpUndefined, returns -1 and creates nothing when the board already has a mechanical layer of either layer kind that the pair kind uses; existing layers are never paired. TMechanicalLayerPairKind.mlpUndefined always adds and pairs two new layers of undefined kind. Returns -1 when the two layers cannot be created; a layer that was created is then removed again.
Export_ToParameters
Writes all pairs into a parameter string.
void Export_ToParameters(ref string argParams);
| Parameter | Type | Passing |
|---|---|---|
argParams | string | ref |
Returns: nothing (void)
FlipLayer
Replaces a mechanical layer with the other layer of its pair.
bool FlipLayer(ref TV6_Layer argL);
bool FlipLayer(ref int argL);
| Parameter | Type | Passing |
|---|---|---|
argL | TV6_Layer | ref |
Returns: bool
The first overload is an extension method of IPCB_MechanicalLayerPairsHelper (using PCB;) with typed parameters; the second is declared by the interface.
When the layer is not in a pair, it is left unchanged. The return value does not report whether the layer was replaced; use FlipLayerV7 for that, or compare the layer before and after the call.
FlipLayerV7
Replaces a mechanical layer with the other layer of its pair; returns true when the layer was replaced.
bool FlipLayerV7(ref V7_LayerBase argL);
bool FlipLayerV7(ref IV7_Layer argL);
| Parameter | Type | Passing |
|---|---|---|
argL | V7_LayerBase | ref |
Returns: bool
The first overload is an extension method of IPCB_MechanicalLayerPairsHelper (using PCB;) with typed parameters; the second is declared by the interface.
Returns false and leaves the layer unchanged when the layer is not in a pair.
Import_FromParameters
Replaces all pairs with the pairs read from a parameter string.
void Import_FromParameters(string argParams);
| Parameter | Type | Passing |
|---|---|---|
argParams | string | value |
Returns: nothing (void)
The collection is cleared first.
LayerUsed
Returns whether the given layer belongs to any pair.
bool LayerUsed(V7_LayerBase argLayer);
bool LayerUsed(IV7_Layer argLayer);
| Parameter | Type | Passing |
|---|---|---|
argLayer | V7_LayerBase | value |
Returns: bool
The first overload is an extension method of IPCB_MechanicalLayerPairsHelper (using PCB;) with typed parameters; the second is declared by the interface.
PairDefined
Returns whether a pair of the two given layers exists, in either order.
bool PairDefined(V7_LayerBase argLayer1, V7_LayerBase argLayer2);
bool PairDefined(IV7_Layer argLayer1, IV7_Layer argLayer2);
| Parameter | Type | Passing |
|---|---|---|
argLayer1 | V7_LayerBase | value |
argLayer2 | V7_LayerBase | value |
Returns: bool
The first overload is an extension method of IPCB_MechanicalLayerPairsHelper (using PCB;) with typed parameters; the second is declared by the interface.
RemovePair
Removes the pair of the two given layers, given in either order; returns true when a pair was removed.
bool RemovePair(V7_LayerBase argLayer1, V7_LayerBase argLayer2);
bool RemovePair(IV7_Layer argLayer1, IV7_Layer argLayer2);
| Parameter | Type | Passing |
|---|---|---|
argLayer1 | V7_LayerBase | value |
argLayer2 | V7_LayerBase | value |
Returns: bool
The first overload is an extension method of IPCB_MechanicalLayerPairsHelper (using PCB;) with typed parameters; the second is declared by the interface.
When a pair is removed, the kinds of both its layers are reset to TMechanicalLayerKind.mlUndefined.