I was working with DelphiScript, and I have a problem, I have the message
expecting ;
I try to solve it, but it is still the same.
The code is this:
procedure CrearPistaDeCobre;
var
PCBBoard: IPCB_Board;
Track: IPCB_Track;
StartPoint, EndPoint: TCoordPoint;
begin
// Obtener la placa activa
PCBBoard := PCBServer.GetCurrentPCBBoard;
if PCBBoard = nil then
begin
ShowMessage('No hay una placa activa.');
Exit;
end;
// Crear un objeto de pista
Track := PCBBoard.AddPCBObject(eTrackObject, eNoDimension) as IPCB_Track;
// Verificar que el objeto creado sea de tipo IPCB_Track
if Track <> nil then
begin
// Establecer los puntos de inicio y fin de la pista
StartPoint := PCBServer.PCBPointFactory.CreatePoint(0, 0);
EndPoint := PCBServer.PCBPointFactory.CreatePoint(MilsToCoord(10000), MilsToCoord(0)); // Convertir mils a coordenadas
// Establecer las propiedades de la pista
Track.SetState_Object(eRouting);
Track.SetWidthInCoord(MilsToCoord(2000)); // Ancho de la pista en mils
Track.SetLayer(LayerStackup.LayerByIndex(3)); // Layer 4 en Altium es índice 3
Track.SetStartPoint(StartPoint);
Track.SetEndPoint(EndPoint);
// Actualizar la placa
PCBBoard.GraphicallyInvalidate;
ShowMessage('Pista de cobre creada exitosamente.');
end;
else
begin
ShowMessage('Error al crear la pista de cobre o el objeto no es de tipo IPCB_Track.');
end;
end;
// Llamar a la función principal
CrearPistaDeCobre;
The error its from this line I think:
Track := PCBBoard.AddPCBObject(eTrackObject, eNoDimension) as IPCB_Track;
I tried to check all the ;
at the end but nothing changed.
How can I fix it?
I add my code…