uses DPSCAD_TLB;
var
ADocument : IPCsDocument;
APage : IPCsPage;
ALines : IPCsLines;
ALine : IPCsLine;
RandomPoint : integer;
PosX, PosY, PosZ : integer;
begin
{check if we're connected to Automation}
if CheckConnection() then // (See function here)
begin
{active project}
ADocument := PCsApplication.ActiveDocument;
{active page}
APage := ADocument.ActivePage;
{all lines}
ALines := APage.Lines;
{get a random line of the lines in the active page}
ALine := ALines.Item[Random(ALines.Count)];
{get a random point of the selected line}
RandomPoint := Random(ALine.Points.Count);
{get positions of that point}
ALine.Points.Item[RandomPoint].GetPosition(PosX,PosY,PosZ);
{modify the positions of that point}
PosX := PosX + 10000;
PosY := PosY + 10000;
{update the line with the new positions}
ALine.Item[RandomPoint].SetPosition(PosX,PosY,PosZ);
{update drawing in Automation through IPCsApplication}
PCsApplication.Redraw;
end;
end;
var
ADocument : IPCsDocument;
APage : IPCsPage;
ALines : IPCsLines;
ALine : IPCsLine;
RandomPoint : integer;
PosX, PosY, PosZ : integer;
begin
{check if we're connected to Automation}
if CheckConnection() then // (See function here)
begin
{active project}
ADocument := PCsApplication.ActiveDocument;
{active page}
APage := ADocument.ActivePage;
{all lines}
ALines := APage.Lines;
{get a random line of the lines in the active page}
ALine := ALines.Item[Random(ALines.Count)];
{get a random point of the selected line}
RandomPoint := Random(ALine.Points.Count);
{get positions of that point}
ALine.Points.Item[RandomPoint].GetPosition(PosX,PosY,PosZ);
{modify the positions of that point}
PosX := PosX + 10000;
PosY := PosY + 10000;
{update the line with the new positions}
ALine.Item[RandomPoint].SetPosition(PosX,PosY,PosZ);
{update drawing in Automation through IPCsApplication}
PCsApplication.Redraw;
end;
end;