uses DPSCAD_TLB;
var
ADocument : IPCsDocument;
APage : IPCsPage;
ATexts : IPCsTexts;
AText : IPCsText;
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 texts}
ATexts := APage.Texts;
{get a random text of the texts in the active page}
AText := ATexts.Item[Random(ATexts.Count)];
{get position of that text}
AText.GetPosition(PosX,PosY,PosZ);
{modify the position of that text}
PosX := PosX + 10000;
PosY := PosY + 10000;
{update the text with the new positions and new text}
AText.SetPosition(PosX,PosY,PosZ);
AText.Value := 'Brand new text';
{update drawing in Automation through IPCsApplication}
PCsApplication.Redraw;
end;
end;
var
ADocument : IPCsDocument;
APage : IPCsPage;
ATexts : IPCsTexts;
AText : IPCsText;
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 texts}
ATexts := APage.Texts;
{get a random text of the texts in the active page}
AText := ATexts.Item[Random(ATexts.Count)];
{get position of that text}
AText.GetPosition(PosX,PosY,PosZ);
{modify the position of that text}
PosX := PosX + 10000;
PosY := PosY + 10000;
{update the text with the new positions and new text}
AText.SetPosition(PosX,PosY,PosZ);
AText.Value := 'Brand new text';
{update drawing in Automation through IPCsApplication}
PCsApplication.Redraw;
end;
end;