How to: Add a symbol


Topic:

Add a symbol


Class hierarchy:

IPCsApplication IPCsDocument IPCsDrawing IPCsPage IPCsSymbol


Description:

Create a variable of IPCsSymbol to store access to a symbol. A Symbol can be modified through this variable


Sourcecode:
[+] Delphi
uses DPSCAD_TLB;

var
  ADocument : IPCsDocument;
  APage : IPCsPage;
  ASymbol : IPCsSymbol;
  Point3D : TPCsPoint3d;
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;

      {set position for circle}
      Point3D.X := 50000;
      Point3D.Y := 50000;
      Point3D.Z := 0;

      {create symbol, with information from a SYM-file}
      ASYmbol := Apage.PlaceSymbol(Point3D,'Filename of existing symbol.SYM');

      {if a symbl is to be created without poiting to a SYM-file, then use
       an instance of IPCsLibType instead, and use this code instead}
      PCsApplication.Redraw;
    end;
end;

[+] Visual Basic
Dim ADocument As Dpscad.PCsDocument
Dim APage As Dpscad.PCsPage
Dim ASymbol As Dpscad.PCsSymbol
Dim Point3D As Dpscad.TPCsPoint3D

If CheckConnection() Then   // (See function here)
  'active project
   ADocument = PCsApplication.ActiveDocument
   'active page
   APage = ADocument.ActivePage
  
   'set position for the symbol
   Point3D.X = 50000
   Point3D.Y = 50000
   Point3D.Z = 0
  
   'create symbol, with information from a SYM-file
   ASymbol = APage.PlaceSymbol(Point3D, "Filename of existing SYM-file")
  
   'if a symbol is to be created without pointing to a SYM-file, then use
   'an instance of IPCsLibType instead, and use this code instead
   PCsApplication.Redraw()
End If

[+] C#
Dpscad.PCsDocument ADocument;
Dpscad.PCsPage APage;
Dpscad.PCsSymbol ASymbol;
Dpscad.TPCsPoint3D Point3D;

if (CheckConnection())   // (See function here)
{
  /*active project*/
  ADocument = PCsApplication.ActiveDocument;
  /*active page*/
  APage = ADocument.ActivePage;

  /*set position for the symbol*/
  Point3D.X = 50000;
  Point3D.Y = 50000;
  Point3D.Z = 0;

  /*create symbol, with information from a SYM-file*/
  ASymbol = APage.PlaceSymbol(Point3D, "Filename of existing SYM-file");

  /*if a symbol is to be created without pointing to a SYM-file, then use
    an instance of IPCsLibType instead, and use this code instead*/
  PCsApplication.Redraw();
}