uses DPSCAD_TLB;
var
ADocument : IPCsDocument;
APage : IPCsPage;
ASymbol : IPCsSymbol;
APt : TPCsPoint3D;
ALibType : IPCsLibType;
ALine : IPCsLine;
Xorg, YOrg, ZOrg, XMove, YMove : 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;
{assigning valus to TPCsPoint3D}
APt.X := 10000;
APt.Y := 10000;
APt.Z := 0;
{creating an instance of a IPCsLibType}
ALibType := Adocument.Drawing.LibTypes.Add('SymbolFileName');
{create line}
ALine := ALibType.Lines.Add();
XOrg := 20000;
YOrg := 20000;
ZOrg := 0;
XMove := 30000;
YMove := 30000;
{adding points, which make a square}
ALine.AddPointXYZ(Xorg,YOrg,ZOrg);
ALine.AddPointXYZ(Xorg+XMove,YOrg,Zorg);
ALine.AddPointXYZ(Xorg+XMove,YOrg+YMove,Zorg);
ALine.AddPointXYZ(Xorg,YOrg+YMove,Zorg);
ALine.AddPointXYZ(Xorg,YOrg,ZOrg);
{create a symbol, from LibType}
ASymbol := Apage.Symbols.Add(ALibType);
{setting position}
ASymbol.Position := Apt;
ASymbol.SymbolTexts.NameText.Value := 'My Symbol'
end;
end;
var
ADocument : IPCsDocument;
APage : IPCsPage;
ASymbol : IPCsSymbol;
APt : TPCsPoint3D;
ALibType : IPCsLibType;
ALine : IPCsLine;
Xorg, YOrg, ZOrg, XMove, YMove : 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;
{assigning valus to TPCsPoint3D}
APt.X := 10000;
APt.Y := 10000;
APt.Z := 0;
{creating an instance of a IPCsLibType}
ALibType := Adocument.Drawing.LibTypes.Add('SymbolFileName');
{create line}
ALine := ALibType.Lines.Add();
XOrg := 20000;
YOrg := 20000;
ZOrg := 0;
XMove := 30000;
YMove := 30000;
{adding points, which make a square}
ALine.AddPointXYZ(Xorg,YOrg,ZOrg);
ALine.AddPointXYZ(Xorg+XMove,YOrg,Zorg);
ALine.AddPointXYZ(Xorg+XMove,YOrg+YMove,Zorg);
ALine.AddPointXYZ(Xorg,YOrg+YMove,Zorg);
ALine.AddPointXYZ(Xorg,YOrg,ZOrg);
{create a symbol, from LibType}
ASymbol := Apage.Symbols.Add(ALibType);
{setting position}
ASymbol.Position := Apt;
ASymbol.SymbolTexts.NameText.Value := 'My Symbol'
end;
end;