Skip to main content
View as Markdown

IPCB_Contour interface

An outline made of an ordered list of vertices, such as the outline or a hole of a region, or one contour of a geometric polygon.

public interface IPCB_Contour

Namespace: PCB · Assembly: Altium.SDK.Interfaces

Remarks​

A contour is created with IPCB_ServerInterface.PCBContourFactory, or obtained from a region with IPCB_Region.GetMainContour and IPCB_Region.GetHole, or from a geometric polygon with IPCB_GeometricPolygon.Contour.

A contour returned by IPCB_GeometricPolygon.Contour refers to the vertices of that polygon: changing the contour changes the polygon. Such a contour is valid only until another contour is added to the polygon. Use Replicate for an independent copy.

Properties​

PropertyTypeAccessDescription
AreadoublegetThe area enclosed by the contour, in square internal units.
Countintget; setThe number of vertices in the contour.
PointXintget; setThe X coordinate of a vertex, in internal units (10,000 per mil).
PointYintget; setThe Y coordinate of a vertex, in internal units (10,000 per mil).

Area​

The area enclosed by the contour, in square internal units.

double GetState_Area();

Type: double · Access: read-only

The value is rounded to a whole number and is never negative, whichever direction the vertices run in. A contour with fewer than three vertices has an area of 0.

Count​

The number of vertices in the contour.

int GetState_Count();
void SetState_Count(int argValue);

Type: int · Access: read/write

Assigning a larger value adds vertices at the end of the contour, assigning a smaller value removes vertices from the end. Added vertices have undefined coordinates until they are assigned with PointX and PointY.

Examples: Extension_CreatePCBLib

PointX​

The X coordinate of a vertex, in internal units (10,000 per mil).

int GetState_PointX(int argI);
void SetState_PointX(int argI, int argValue);

Type: int · Access: read/write · Index: argI (int): The zero-based index of the vertex. An index outside 0 to Count - 1, including a negative one, is wrapped around: an index of Count addresses the first vertex, an index of -1 the last.

Reading or assigning a vertex of an empty contour raises an error.

Examples: Extension_CreatePCBLib

PointY​

The Y coordinate of a vertex, in internal units (10,000 per mil).

int GetState_PointY(int argI);
void SetState_PointY(int argI, int argValue);

Type: int · Access: read/write · Index: argI (int): The zero-based index of the vertex. An index outside 0 to Count - 1, including a negative one, is wrapped around: an index of Count addresses the first vertex, an index of -1 the last.

Reading or assigning a vertex of an empty contour raises an error.

Examples: Extension_CreatePCBLib

Methods​

MethodReturnsDescription
AddContourvoidAppends a range of vertices of another contour to the end of this contour.
AddContour_1voidAppends all vertices of another contour to the end of this contour.
AddPointvoidAdds a vertex at the end of the contour.
ClearvoidRemoves all vertices from the contour.
DeletePointvoidRemoves a vertex from the contour; the vertices after it move down by one position.
EnsureCapacityvoidReserves storage for at least the given number of vertices, without changing Count.
InsertPointvoidInserts a vertex into the contour; the vertex at the given position and those after it move up by one position.
ReplicateIPCB_ContourReturns an independent copy of the contour; changing the copy does not change the original, and the reverse.
RotatevoidRotates every vertex of the contour about the origin (0, 0).
RotateAboutPointvoidRotates every vertex of the contour about a given point.
TranslatevoidMoves every vertex of the contour by a given offset.

AddContour​

Appends a range of vertices of another contour to the end of this contour.

void AddContour(IPCB_Contour argC, int argStartIndex, int argEndIndex);
void AddContour(object argC, int argStartIndex, int argEndIndex);
ParameterTypePassingDescription
argCIPCB_ContourvalueThe contour whose vertices are appended.
argStartIndexintvalueThe zero-based index of the first vertex of argC to append.
argEndIndexintvalueThe zero-based index of the last vertex of argC to append. When it is less than argStartIndex, the range runs to the last vertex of argC and continues from its first vertex.

Returns: nothing (void)

The first overload is an extension method of IPCB_ContourHelper (using PCB;) with typed parameters; the second is declared by the interface.

The range includes both ends, so at least one vertex is added.

AddContour_1​

Appends all vertices of another contour to the end of this contour.

void AddContour_1(IPCB_Contour argC);
void AddContour_1(object argC);
ParameterTypePassingDescription
argCIPCB_ContourvalueThe contour whose vertices are appended.

Returns: nothing (void)

The first overload is an extension method of IPCB_ContourHelper (using PCB;) with typed parameters; the second is declared by the interface.

AddPoint​

Adds a vertex at the end of the contour.

void AddPoint(int argx, int argy);
ParameterTypePassingDescription
argxintvalueThe X coordinate of the new vertex, in internal units (10,000 per mil).
argyintvalueThe Y coordinate of the new vertex, in internal units (10,000 per mil).

Returns: nothing (void)

Clear​

Removes all vertices from the contour.

void Clear();

Returns: nothing (void)

DeletePoint​

Removes a vertex from the contour; the vertices after it move down by one position.

void DeletePoint(int argIndex);
ParameterTypePassingDescription
argIndexintvalueThe zero-based index of the vertex to remove, from 0 to Count - 1.

Returns: nothing (void)

EnsureCapacity​

Reserves storage for at least the given number of vertices, without changing Count.

void EnsureCapacity(int argValue);
ParameterTypePassingDescription
argValueintvalueThe number of vertices to reserve storage for.

Returns: nothing (void)

InsertPoint​

Inserts a vertex into the contour; the vertex at the given position and those after it move up by one position.

void InsertPoint(int argIndex, int argx, int argy);
ParameterTypePassingDescription
argIndexintvalueThe zero-based index that the new vertex receives.
argxintvalueThe X coordinate of the new vertex, in internal units (10,000 per mil).
argyintvalueThe Y coordinate of the new vertex, in internal units (10,000 per mil).

Returns: nothing (void)

Replicate​

Returns an independent copy of the contour; changing the copy does not change the original, and the reverse.

IPCB_Contour Replicate();

Returns: IPCB_Contour

Extension method of IPCB_ContourHelper (using PCB;).

Rotate​

Rotates every vertex of the contour about the origin (0, 0).

void Rotate(double argngleInDegrees);
ParameterTypePassingDescription
argngleInDegreesdoublevalueThe rotation angle, in degrees.

Returns: nothing (void)

The rotated coordinates are rounded to whole internal units, so repeated rotations accumulate rounding errors.

RotateAboutPoint​

Rotates every vertex of the contour about a given point.

void RotateAboutPoint(double argngleInDegrees, int argx, int argy);
ParameterTypePassingDescription
argngleInDegreesdoublevalueThe rotation angle, in degrees.
argxintvalueThe X coordinate of the center of rotation, in internal units (10,000 per mil).
argyintvalueThe Y coordinate of the center of rotation, in internal units (10,000 per mil).

Returns: nothing (void)

The rotated coordinates are rounded to whole internal units, so repeated rotations accumulate rounding errors.

Translate​

Moves every vertex of the contour by a given offset.

void Translate(int argx, int argy);
ParameterTypePassingDescription
argxintvalueThe offset added to the X coordinate of every vertex, in internal units (10,000 per mil).
argyintvalueThe offset added to the Y coordinate of every vertex, in internal units (10,000 per mil).

Returns: nothing (void)

Returned by​

IPCB_GeometricPolygon.AddContour, IPCB_GeometricPolygon.AddContourIsHole, IPCB_GeometricPolygon.AddEmptyContour, IPCB_GeometricPolygon.Contour, IPCB_Region.GetHole, IPCB_Region.GetMainContour, IPCB_ServerInterface.PCBContourFactory

Accepted by​

IPCB_Board.AddPolygonMesh, IPCB_BoardEx.AddPolygonMeshToLayer, IPCB_ContourMaker.AddArcToContour, IPCB_ContourMaker.MakeContour_AddSlot, IPCB_ContourMaker.MakeContour_AddSquare, IPCB_ContourUtilities.ClipContourContour, IPCB_ContourUtilities.ClipSetContour, IPCB_ContourUtilities.ContourArea, IPCB_ContourUtilities.ContourIsCW, IPCB_ContourUtilities.PointInContour, IPCB_GeometricPolygon.AddContour, IPCB_GeometricPolygon.AddContourIsHole, IPCB_Region.SetOutlineContour, IPCB_ServerInterface.DestroyPCBContour

Examples​

Used in the SDK examples: Extension_CreatePCBLib.