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
| Property | Type | Access | Description |
|---|---|---|---|
| Area | double | get | The area enclosed by the contour, in square internal units. |
| Count | int | get; set | The number of vertices in the contour. |
| PointX | int | get; set | The X coordinate of a vertex, in internal units (10,000 per mil). |
| PointY | int | get; set | The 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
| Method | Returns | Description |
|---|---|---|
| AddContour | void | Appends a range of vertices of another contour to the end of this contour. |
| AddContour_1 | void | Appends all vertices of another contour to the end of this contour. |
| AddPoint | void | Adds a vertex at the end of the contour. |
| Clear | void | Removes all vertices from the contour. |
| DeletePoint | void | Removes a vertex from the contour; the vertices after it move down by one position. |
| EnsureCapacity | void | Reserves storage for at least the given number of vertices, without changing Count. |
| InsertPoint | void | Inserts a vertex into the contour; the vertex at the given position and those after it move up by one position. |
| Replicate | IPCB_Contour | Returns an independent copy of the contour; changing the copy does not change the original, and the reverse. |
| Rotate | void | Rotates every vertex of the contour about the origin (0, 0). |
| RotateAboutPoint | void | Rotates every vertex of the contour about a given point. |
| Translate | void | Moves 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);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argC | IPCB_Contour | value | The contour whose vertices are appended. |
argStartIndex | int | value | The zero-based index of the first vertex of argC to append. |
argEndIndex | int | value | The 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);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argC | IPCB_Contour | value | The 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);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argx | int | value | The X coordinate of the new vertex, in internal units (10,000 per mil). |
argy | int | value | The 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);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argIndex | int | value | The 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);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argValue | int | value | The 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);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argIndex | int | value | The zero-based index that the new vertex receives. |
argx | int | value | The X coordinate of the new vertex, in internal units (10,000 per mil). |
argy | int | value | The 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);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argngleInDegrees | double | value | The 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);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argngleInDegrees | double | value | The rotation angle, in degrees. |
argx | int | value | The X coordinate of the center of rotation, in internal units (10,000 per mil). |
argy | int | value | The 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);
| Parameter | Type | Passing | Description |
|---|---|---|---|
argx | int | value | The offset added to the X coordinate of every vertex, in internal units (10,000 per mil). |
argy | int | value | The 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.