Schematic API Functions reference
SchServer Interface
Function SchServer : ISch_ServerInterface;
Description
The SchServer function (from the EDPClasses_Sch unit) returns the interface of the loaded Schematic Editor module in Altium Designer. To work with Schematic objects, you need to have access to the ISch_ServerInterface interface first. To obtain the current schematic document, invoke the SchServer.GetCurrentSchDocument for instance.
Refer to the ISch_ServerInterface's methods and properties for more information.
Example 1
// Grab current schematic document.
SchDoc := SchServer.GetCurrentSchDocument;
If SchDoc = Nil Then Exit;
// Component is a container that has child objects
// Create component, and its rectangle, pin and parameter objects.
Component := SchServer.SchObjectFactory (eSchComponent, eCreate_Default);
Example 2
Try
SchServer.ProcessControl.PreProcess(SchDoc, '');
// Add the parameter to the pin with undo stack also enabled
Param.Name := 'Added Parameter';
Param.Text := 'Param added to the pin. Press Undo and this will disappear. Press undo twice to remove the component';
Param.Location := Point(InchesToCoord(3), InchesToCoord(2.4));
Pin.AddSchObject(Param);
SchServer.RobotManager.SendMessage(Component.I_ObjectAddress, c_BroadCast, SCHM_PrimitiveRegistration, Param.I_ObjectAddress);
Finally
SchServer.ProcessControl.PostProcess(SchDoc, '');
End;
See also
ISch_ServerInterface interface
Schematic API functions
The schematic API functions are derived from the EDPUtil_Sch unit part of the SDK.
ModelTypeManager
Function ModelTypeManager : IModelTypeManager;
IntegratedLibraryManager
Function IntegratedLibraryManager : IIntegratedLibraryManager;
GetState_AllImplementations
Function GetState_AllImplementations (Const ASchComponent : ISch_Component) : TInterfaceList;
GetState_PinsForCurrentMode
Function GetState_PinsForCurrentMode (Const ASchComponent : ISch_Component) : TInterfaceList;
GetState_AllPins
Function GetState_AllPins (Const ASchComponent : ISch_Component) : TInterfaceList;
GetState_AllComponents
Function GetState_AllComponents (Const ASchLib : ISch_Lib) : TInterfaceList;
GetState_AllParameters
Function GetState_AllParameters (Const ASchObject : ISch_BasicContainer) : TInterfaceList;