Friday, May 31, 2013

Scripts - Server Processes Reference

Shown below is a simple Delphi Script I created to break all Component Groups in a PCB.

// Break All Component Groups
// Randy Clemmons

Var
 Board : IPCB_Board;

Procedure Start;
begin
   Board := PCBServer.GetCurrentPCBBoard;
   if Board = nil then
   begin
        ShowMessage('Active Window is Not a .PcbDoc File');
        exit;
   end;

   // http://wiki.altium.com/display/ADOH/PCB+Processes
   // Examples
   // Process: PCB:GroupPrimitives
   // Parameters: Action=BreakAllComponentUnions
   // Parameters: Action=Explode | Object=ALL

    AddStringParameter('Action','BreakAllComponentUnions');
    RunProcess('PCB:GroupPrimitives');
end;


Modifying Schematic Objects (Altium Forum)

To modify Schematic objects on a current Schematic document, you will need to invoke certain methods in a particular order to ensure the Undo/Redo system is up to date when a schematic object’s attributes have been modified programmatically.
The sequence is as follows:
  • Invoke the PreProcess method which initialize the robots in the schematic server
  • Send a SCHM_BeginModify message
  • Modify the Schematic object by changing its attributes (Properties)
  • Send a SCHM_EndModify message
  • Invoke the PostProcess method to clean up the robots in the Schematic server.


No comments:

Post a Comment