Skip to main content
View as Markdown

IProcessControl interface

The IProcessControl interface controls the process depth for each design document in Altium Designer. Every time a process is launched on a document, the process depth is increased by one and once this same process has finished executing, the process depth is decreased by one. When the process depth is zero, it denotes that nothing is taking place on the current design document. This is necessary if you wish to keep the environment synchronized, especially the Undo system.

public interface IProcessControl

Namespace: DXP · Assembly: Altium.SDK.Interfaces

Properties​

PropertyTypeAccessDescription
ProcessDepthintget; setSets or gets the process depth.

ProcessDepth​

Sets or gets the process depth. The depth value is an integer value.0 = inactive, and 1 onwards denotes the number of stacked processes.

int GetProcessDepth();
void SetProcessDepth(int argValue);

Type: int · Access: read/write

Example: Show the current process depth.

using DXP;

DXP.Utils.ShowMessage("Current process depth " + DXP.GlobalVars.Client.GetProcessControl().GetProcessDepth());

Methods​

MethodReturnsDescription
PostProcessvoidThis method performs a post processing within in a main server which could involve finalizing the states of the environment of the server such as the Undo system.
PreProcessvoidPerforms pre processing within in a main server which could involve resetting the environment of the server.

PostProcess​

This method performs a post processing within in a main server which could involve finalizing the states of the environment of the server such as the Undo system.

void PostProcess(object argContext, string argParameters);
ParameterTypePassingDescription
argContextobjectvalueUsually the focussed document in Altium Designer such as the ISch_Document and IPCB_Board interfaces.
argParametersstringvalue

Returns: nothing (void)

See also: IProcessControl.PreProcess

PreProcess​

Performs pre processing within in a main server which could involve resetting the environment of the server.

void PreProcess(object argContext, string argParameters);
ParameterTypePassingDescription
argContextobjectvalueUsually the focussed document in Altium Designer such as the ISch_Document and IPCB_Board interfaces.
argParametersstringvalue

Returns: nothing (void)

Example: Place a new port on the current schematic sheet between PreProcess and PostProcess.

using DXP;
using SCH;

ISch_ServerInterface schServer = SCH.GlobalVars.SchServer;
ISch_Document doc = schServer?.GetCurrentSchDocument();
if (doc == null)
return;
IProcessControl processControl = DXP.GlobalVars.Client.GetProcessControl();

// Initialize the robots in the schematic editor.
processControl.PreProcess(doc, "");

// Create a new port and place it on the current schematic document.
var schPort = schServer.SchObjectFactory(TObjectId.ePort, TObjectCreationMode.eCreate_GlobalCopy) as ISch_Port;
if (schPort == null)
return;
schPort.SetState_Location(new DXP.Point(new SPoint { X = 100, Y = 100 }));
schPort.SetState_Style(TPortArrowStyle.ePortRight);
schPort.SetState_IOType(TPortIO.ePortBidirectional);
schPort.SetState_Alignment(THorizontalAlign.eHorizontalCentreAlign);
schPort.SetState_Width(100);
schPort.SetState_AreaColor(0);
schPort.SetState_TextColor(0xFFFF00);
schPort.SetState_Name("New Port 1");

// Add the new port object to the existing schematic document.
doc.RegisterSchObjectInContainer(schPort);
schServer.GetState_RobotManager().SendMessage(doc, SCHConstant.BroadCast, SCHConstant.SCHMPrimitiveRegistration, schPort);

// Clean up the robots in the schematic editor.
processControl.PostProcess(doc, "");

See also: IProcessControl.PostProcess

Returned by​

IClient.GetProcessControl, IServerModule.GetProcessControl, ServerModule.ProcessControl