Trying to draw a circular board shape in Altium Professional. enter image description here I am getting this error message for all methods in this script, including BoardOutline, RemoveAllVertices and AddVertex. Why is Altium asking me to declare these "identifiers" when they are supposedly built in methods?
I asked chatgpt how to draw the circle, and followed each instruction.
Chatgpt:
To make the board circular in Altium Designer using Pascal scripting, you can modify the BoardOutline property of the IPCB_Board interface. Here's an example code snippet to create a circular board shape:
pascal
Copy code
var
PCBBoard: IPCB_Board;
BoardShape: IPCB_BoardShape;
Vertices: T2DVertexes;
CenterX, CenterY, Radius: Double;
Angle: Double;
NumSegments: Integer;
i: Integer;
begin
// Get the current PCB board
PCBBoard := PCBServer.GetCurrentPCBBoard;
// Access the board shape
BoardShape := PCBBoard.BoardOutline;
// Clear existing vertices
BoardShape.RemoveAllVertices;
// Define the center coordinates and radius of the circle
CenterX := MilsToCoord(5000); // Center X coordinate in mils
CenterY := MilsToCoord(5000); // Center Y coordinate in mils
Radius := MilsToCoord(5000); // Radius in mils
// Define the number of segments to approximate the circle
NumSegments := 100;
// Calculate and add vertices to approximate the circular shape
for i := 0 to NumSegments - 1 do
begin
Angle := i * 2 * Pi / NumSegments;
Vertices.AddVertex(CenterX + Radius * Cos(Angle), CenterY + Radius * Sin(Angle));
end;
// Update the board shape
BoardShape.UpdateVertices;
end;
In the code snippet above, we retrieve the current PCB board using PCBServer.GetCurrentPCBBoard. Then, we access the BoardOutline property of the IPCB_Board interface to get the board shape object.
We clear any existing vertices from the BoardShape object using the RemoveAllVertices method. Next, we define the center coordinates (CenterX and CenterY) and the radius of the circle (Radius) in mils.
We also specify the number of segments (NumSegments) to approximate the circular shape. In this example, we use 100 segments.
We then calculate the angle for each segment and add the corresponding vertices to approximate the circular shape using the Vertices.AddVertex method.
Finally, we update the board shape by calling the UpdateVertices method of the BoardShape object.
Remember to save your changes and update the PCB document for the circular board shape to take effect.
I hope this helps!