IPCB_LibComponent interface
A footprint (library component) in a PCB library document.
public interface IPCB_LibComponent : IPCB_Group
Namespace: PCB · Assembly: Altium.SDK.Interfaces
Inherits: IPCB_Primitive → IPCB_Group
Remarks
A PCB library document holds a list of footprints, the "pages" of the library, and each of them is represented by an IPCB_LibComponent. Get them from the IPCB_Library: with IPCB_Library.GetComponent, IPCB_Library.GetComponentByName, or with an IPCB_LibraryIterator created by IPCB_Library.LibraryIterator_Create and released by IPCB_Library.LibraryIterator_Destroy. The footprint in focus in the library editor is IPCB_Library.CurrentComponent.
IPCB_LibComponent is derived from IPCB_Group. A footprint is composed of child objects such as pads and tracks, which you fetch with the footprint's own IPCB_GroupIterator.
The primitives of the current footprint are placed on the library's board (IPCB_Library.Board) for display and editing; TransferAllPrimitivesOntoBoard and TransferAllPrimitivesBackFromBoard move them between the footprint and that board.
Example
Write the name, height and description of every footprint in the current PCB library to a CSV report.
using System.Collections.Generic;
using System.IO;
using DXP;
using PCB;
IPCB_Library currentLib = PCB.GlobalVars.PCBServer?.GetCurrentPCBLibrary();
if (currentLib == null)
return;
string fileName = Path.Combine(Path.GetDirectoryName(currentLib.GetState_Board().GetState_FileName()), "PCBLib_Report.csv");
string s = "";
var footprintList = new List<string>();
IPCB_LibraryIterator footprintIterator = currentLib.LibraryIterator_Create();
footprintIterator.SetState_FilterAll();
try
{
var footprint = footprintIterator.FirstPCBObject() as IPCB_LibComponent;
while (footprint != null)
{
// The height is reported in mils when the display unit is metric,
// and in millimeters otherwise.
if (currentLib.GetState_Board().GetState_DisplayUnit() == TUnit.eMetric)
s = footprint.GetState_Pattern()
+ ","
+ EDP.Utils.CoordToMils(footprint.GetState_Height())
+ ","
+ footprint.GetState_Description();
else
s = footprint.GetState_Pattern()
+ ","
+ EDP.Utils.CoordToMMs(footprint.GetState_Height())
+ ","
+ footprint.GetState_Description();
footprintList.Add(s);
footprint = footprintIterator.NextPCBObject() as IPCB_LibComponent;
}
}
finally
{
currentLib.LibraryIterator_Destroy(ref footprintIterator);
File.WriteAllLines(fileName, footprintList);
}
// Display the saved report.
IClient client = DXP.GlobalVars.Client;
IServerDocument reportDocument = client.OpenDocument("Text", fileName);
if (reportDocument != null)
client.ShowDocument(reportDocument);
Properties
| Property | Type | Access | Description |
|---|---|---|---|
| Description | string | get; set | The description of the footprint. |
| Height | int | get; set | The height of the footprint, in internal units (10,000 per mil). |
| ItemGUID | string | get; set | The GUID of the server Item that the footprint is linked to for release. |
| ItemRevisionGUID | string | get; set | The GUID of the Item revision that the footprint is linked to for release. |
| Pattern | string | get; set | The name (pattern) of the footprint. |
Description
The description of the footprint.
string GetState_Description();
void SetState_Description(string argValue);
Type: string · Access: read/write
Height
The height of the footprint, in internal units (10,000 per mil).
int GetState_Height();
void SetState_Height(int argValue);
Type: int · Access: read/write
ItemGUID
The GUID of the server Item that the footprint is linked to for release.
string GetState_ItemGUID();
void SetState_ItemGUID(string argValue);
Type: string · Access: read/write
ItemRevisionGUID
The GUID of the Item revision that the footprint is linked to for release.
string GetState_ItemRevisionGUID();
void SetState_ItemRevisionGUID(string argValue);
Type: string · Access: read/write
Pattern
The name (pattern) of the footprint.
string GetState_Pattern();
void SetState_Pattern(string argValue);
Type: string · Access: read/write
Leading and trailing spaces are removed from an assigned value.
Examples: Extension_CreatePCBLib, Extension_PcbLibComponentToSTEP, Extension_PcbLibToImage
Methods
| Method | Returns | Description |
|---|---|---|
| CopyTo | void | Copies the footprint's primitives and properties into another footprint. |
| ReleasableInterface | object | |
| SaveModelToFile | bool | Exports the 3D models of the footprint's 3D bodies to a file. |
| SaveToFile | void | Saves the footprint on its own to a PCB library file. |
| TransferAllPrimitivesBackFromBoard | void | Moves the primitives on the library's board into the footprint; the reverse of TransferAllPrimitivesOntoBoard. |
| TransferAllPrimitivesOntoBoard | void | Places the footprint's primitives on the library's board, where they are displayed and edited. |
CopyTo
Copies the footprint's primitives and properties into another footprint.
void CopyTo(IPCB_LibComponent argP, TCopyMode argCopyMode);
void CopyTo(object argP, int argCopyMode);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argP | IPCB_LibComponent | value | The footprint to copy into. |
argCopyMode | TCopyMode | value | The copy mode used to replicate each primitive. |
Returns: nothing (void)
The first overload is an extension method of IPCB_LibComponentHelper (using PCB;) with typed parameters; the second is declared by the interface.
Each child primitive of this footprint is replicated with the given copy mode and added to the target footprint. The description, height, ItemGUID and ItemRevisionGUID are copied to the target as well.
ReleasableInterface
No description yet.
object ReleasableInterface();
Returns: object
SaveModelToFile
Exports the 3D models of the footprint's 3D bodies to a file.
bool SaveModelToFile(string argFilename, bool argSaveAsPart);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argFilename | string | value | The path of the file to write. |
argSaveAsPart | bool | value | false exports the models to a STEP file; true saves them as a part. |
Returns: bool
The models are positioned relative to the footprint's location. Nothing is written when none of the footprint's 3D bodies has a model. The returned value is not set and does not indicate whether a file was written.
SaveToFile
Saves the footprint on its own to a PCB library file.
void SaveToFile(string argVFSAddress);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argVFSAddress | string | value | The path of the PCB library file to write. |
Returns: nothing (void)
The file holds a library that contains only this footprint. When the footprint is the current footprint of its library, its primitives are taken back from the library's board for the save and placed on the board again afterwards.
TransferAllPrimitivesBackFromBoard
Moves the primitives on the library's board into the footprint; the reverse of TransferAllPrimitivesOntoBoard.
void TransferAllPrimitivesBackFromBoard();
Returns: nothing (void)
The primitives on the board, on all layers, become child objects of the footprint and are deselected. They are moved by the negative of the board origin, so that the footprint's coordinates are relative to the board origin.
TransferAllPrimitivesOntoBoard
Places the footprint's primitives on the library's board, where they are displayed and edited.
void TransferAllPrimitivesOntoBoard();
Returns: nothing (void)
The primitives are moved by 50,000 mils in X and Y, and the board origin is set to that point, so that the footprint's coordinates are relative to the board origin.
Inherited members
- From IPCB_Group: AddPCBObject, FastSetState_XSizeYSize, FreePrimitives, GetPrimitiveAt, GetPrimitiveCount, GroupIterator_Create, GroupIterator_Destroy, LayerUsed, PrimitiveLock, RemovePCBObject, ReplicateWithChildren, SetState_LayersUsedArray, SetState_XSizeYSize, XLocation, YLocation
- From IPCB_Primitive: AllowGlobalEdit, BeginModify, Board, BoundingRectangle, BoundingRectangleChildren, BoundingRectangleForPainting, BoundingRectangleForSelection, CancelModify, Component, Coordinate, DescriptorString, DetailString, Dimension, DrawAsPreview, DRCError, Enabled, Enabled_Direct, Enabled_vComponent, Enabled_vCoordinate, Enabled_vDimension, Enabled_vNet, Enabled_vPolygon, EnableDraw, EndModify, Export_ToParameters, FlipXY, GraphicallyInvalidate, Handle, Identifier, InBoard, InComponent, InCoordinate, Index, InDimension, InNet, InPolygon, InSelectionMemory, IsAssyTestPoint_Bottom, IsAssyTestPoint_Top, IsElectricalPrim, IsFreePrimitive, IsHidden, IsKeepout, IsPreRoute, IsSaveable, IsTenting, IsTenting_Bottom, IsTenting_Top, IsTestPoint_Bottom, IsTestPoint_Top, Layer, MiscFlag1, MiscFlag2, MiscFlag3, Moveable, MoveByXY, MoveToXY, Net, ObjectID, ObjectIDString, PadCacheRobotFlag, PasteMaskExpansion, Polygon, PolygonOutline, PowerPlaneClearance, PowerPlaneConnectStyle, PowerPlaneReliefExpansion, Preview, ReliefAirGap, ReliefConductorWidth, ReliefEntries, Replicate, RequiredParamterSpace, RotateBy, Selected, SolderMaskExpansion, SwapLayerPairs, TearDrop, UnionIndex, UniqueId, UniqueID, Used, UserRouted, V7Layer, ViewableObjectID
Returned by
IPCB_Library.AddComponent, IPCB_Library.CreateNewComponent, IPCB_Library.CurrentComponent, IPCB_Library.GetComponent, IPCB_Library.GetComponentByName, IPCB_ServerInterface.CreatePCBLibComp, IPCB_ServerInterface.LoadCompFromLibrary
Accepted by
IPCB_ComponentPainterView.SetComponentByHandle_1, IPCB_Library.DeRegisterComponent, IPCB_Library.RegisterComponent, IPCB_Library.RemoveComponent, IPCB_ServerInterface.DestroyPCBLibComp
Examples
Used in the SDK examples: Extension_CreatePCBLib, Extension_PcbLibComponentToSTEP, Extension_PcbLibToImage.