IPCB_MechanicalLayer interface
A mechanical layer of a PCB document, a general-purpose layer for the board layout, dimensions, fabrication details or any other mechanical details the design requires.
public interface IPCB_MechanicalLayer : IPCB_LayerObject
Namespace: PCB · Assembly: Altium.SDK.Interfaces
Inherits: IPCB_LayerObject
Remarks
A board can have up to 1,024 mechanical layers.
The examples visit the mechanical layers of a board with IPCB_Board.MechanicalLayerIterator and cast each IPCB_LayerObjectIterator.LayerObject to IPCB_MechanicalLayer. Mechanical layers are not in the layer stack, but IPCB_LayerStack.LayerObject also returns the layer object of a mechanical layer.
Example
Show whether each mechanical layer of the current board is linked, enabled and displayed in single layer mode.
using PCB;
IPCB_Board pcbBoard = PCB.GlobalVars.PCBServer?.GetCurrentPCBBoard();
if (pcbBoard == null)
return;
// Note that the Layer stack only stores existing copper based layers.
// But you can use the LayerObject method to fetch all layers.
IPCB_LayerStack theLayerStack = pcbBoard.GetState_LayerStack();
if (theLayerStack == null)
return;
for (TV6_Layer layer = TV6_Layer.eV6_Mechanical1; layer <= TV6_Layer.eV6_Mechanical16; layer++)
{
var layerObj = theLayerStack.LayerObject(layer) as IPCB_MechanicalLayer;
if (layerObj == null)
continue;
DXP.Utils.ShowMessage(EDP.Utils.LayerToString(new V7_Layer(layer)) + "\r" +
" linked " + layerObj.GetState_LinkToSheet() + "\r" +
" enabled " + layerObj.GetState_MechLayerEnabled() + "\r" +
" displayed in single layer mode " + layerObj.GetState_DisplayInSingleLayerMode() + "\r");
}
Properties
| Property | Type | Access | Description |
|---|---|---|---|
| DisplayInSingleLayerMode | bool | get; set | Whether the objects on the mechanical layer stay visible while single layer mode hides the other layers. |
| Kind | TMechanicalLayerKind | get; set | The kind of the mechanical layer, the role it has on the board, such as assembly notes, dimensions or board shape. |
| LinkToSheet | bool | get; set | Whether the mechanical layer is linked to the sheet of the PCB document. |
| MechLayerEnabled | bool | get; set | Whether the mechanical layer is enabled on the PCB document. |
DisplayInSingleLayerMode
Whether the objects on the mechanical layer stay visible while single layer mode hides the other layers.
bool GetState_DisplayInSingleLayerMode();
void SetState_DisplayInSingleLayerMode(bool argValue);
Type: bool · Access: read/write
Reads false, and setting it does nothing, when the layer does not belong to a board.
Kind
The kind of the mechanical layer, the role it has on the board, such as assembly notes, dimensions or board shape.
TMechanicalLayerKind GetState_Kind();
void SetState_Kind(TMechanicalLayerKind argValue);
Type: TMechanicalLayerKind · Access: read/write
The accessors are extension methods of IPCB_MechanicalLayerHelper (using PCB;).
Setting a kind does nothing when the layer already has that kind, when another mechanical layer of the board already has it, or when it is a kind of a layer pair: the kinds that end in Top or Bottom, such as TMechanicalLayerKind.mlAssemblyTop.
Setting TMechanicalLayerKind.mlSheet also sets LinkToSheet to true, and changing the kind from it sets LinkToSheet to false. Setting TMechanicalLayerKind.mlRouteToolPath makes the layer the board's IPCB_Board.RouteToolPathLayer, and changing the kind from it sets that property to no layer.
See also: IPCB_MechanicalLayerPairs.LayerPairKind
LinkToSheet
Whether the mechanical layer is linked to the sheet of the PCB document.
bool GetState_LinkToSheet();
void SetState_LinkToSheet(bool argValue);
Type: bool · Access: read/write
Once a layer is linked to the sheet, the sheet is resized automatically to fit the objects on the linked layer when a zoom command is executed. Reads false, and setting it does nothing, when the layer does not belong to a board.
MechLayerEnabled
Whether the mechanical layer is enabled on the PCB document.
bool GetState_MechLayerEnabled();
void SetState_MechLayerEnabled(bool argValue);
Type: bool · Access: read/write
Setting it to false does not check whether design objects are on the layer.
Methods
| Method | Returns | Description |
|---|---|---|
| MirroredLayer | bool | Returns whether the mechanical layer belongs to a mechanical layer pair, and gives the other layer of the pair. |
MirroredLayer
Returns whether the mechanical layer belongs to a mechanical layer pair, and gives the other layer of the pair.
bool MirroredLayer(out V7_LayerBase argMirrorLayer, IPCB_Board argBoard);
bool MirroredLayer(out IV7_Layer argMirrorLayer, object argBoard);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argMirrorLayer | V7_LayerBase | out | Receives the other layer of the pair, or the layer itself when it is not in a pair. |
argBoard | IPCB_Board | value | The board whose IPCB_Board.MechanicalPairs are used; null for the board the layer belongs to. |
Returns: bool
The first overload is an extension method of IPCB_MechanicalLayerHelper (using PCB;) with typed parameters; the second is declared by the interface.
Inherited members
- From IPCB_LayerObject: IsInLayerStack, LayerDisplayName, LayerName, LayerStack, UsedByPrims, V6_LayerID, V7_LayerID
Returned by
IPCB_MasterLayerStack2.AddMechanicalLayer, IPCB_MasterLayerStack2.FindLayerByKind, IPCB_MasterLayerStack2.GetMechanicalLayer