Skip to main content
View as Markdown

ISch_ServerInterface interface

This interface is an entry interface to the schematic server loaded in Altium Designer. You can fetch the Preferences, Robot Manager (for sending messages into the schematic system), the font manager for managing fonts on a schematic document. You can also create or delete schematic design objects from this interface.

public interface ISch_ServerInterface

Namespace: SCH · Assembly: Altium.SDK.Interfaces

Remarks​

The ISch_ServerInterface as the composite interface has the following aggregate object interfaces:

Note that these IServerModule interfaces represent loaded servers in Altium Designer. This application manages single instances of different server modules. Each server can have multiple server document kinds, for example the Schematic server supports two server document kinds - SCH and SCHLIB design documents. A loaded server typically hosts documents and each document in turn hosts a document view and panel views. Thus a Schematic Editor server also has the IServerModule interface along with the ISch_ServerInterface interface.

Read SCH.GlobalVars.SchServer to obtain the ISch_ServerInterface object interface which represents the Schematic Editor server.

Properties​

PropertyTypeAccessDescription
FontManagerISch_FontManagergetThis property retrieves the Font manager object which is represented by the ISch_FontManager interface.
JunctionConvertSettingsISch_JunctionConvertSettingsgetThe JunctionConvertSettings property represents a crossing of wiring on a schematic sheet.
ProbesTimerEnabledboolget; setThe ProbesTimerEnabled property determines whether the Probes are active or not.
RobotManagerISch_RobotManagergetThis property returns the ISch_RobotManager interface.
SchPreferencesISch_PreferencesgetThis Preferences property retrieves the ISch_Preferences interface which represents the Preferences object for the Schematic Editor.

FontManager​

This property retrieves the Font manager object which is represented by the ISch_FontManager interface.

ISch_FontManager GetState_FontManager();

Type: ISch_FontManager · Access: read-only

The accessors are extension methods of ISch_ServerInterfaceHelper (using SCH;).

See also: ISch_FontManager2

JunctionConvertSettings​

The JunctionConvertSettings property represents a crossing of wiring on a schematic sheet. When an addition of a wire would create a four-way junction, this is converted to into two adjacent three way junctions. If it is disabled and when a four way junction is created, the two wires crossing at the intersection are not joined electrically and if the Display Cross Overs option is enabled, a cross over is shown on this intersection.

ISch_JunctionConvertSettings GetState_JunctionConvertSettings();

Type: ISch_JunctionConvertSettings · Access: read-only

The accessors are extension methods of ISch_ServerInterfaceHelper (using SCH;).

See also: ISch_JunctionConvertSettings

ProbesTimerEnabled​

The ProbesTimerEnabled property determines whether the Probes are active or not. This feature is used in the LiveDesign process in Altium Designer.

bool GetState_ProbesTimerEnabled();
void SetState_ProbesTimerEnabled(bool argValue);

Type: bool · Access: read/write

RobotManager​

This property returns the ISch_RobotManager interface. This interface deals with sending Schematic notification messages in the system. To have the ability to send a specific message when a specific event in the Schematic Editor occurs can be achieved with the ISch_RobotManager interface.

ISch_RobotManager GetState_RobotManager();

Type: ISch_RobotManager · Access: read-only

The accessors are extension methods of ISch_ServerInterfaceHelper (using SCH;).

Example: Place a port on the current schematic sheet and register it with the robot manager.

using DXP;
using SCH;

ISch_ServerInterface schServer = SCH.GlobalVars.SchServer;
ISch_Document doc = schServer?.GetCurrentSchDocument();
if (doc == null)
return;

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 = EDP.Utils.MilsToCoord(2500), Y = EDP.Utils.MilsToCoord(2500) }));
schPort.SetState_Style(TPortArrowStyle.ePortRight);
schPort.SetState_IOType(TPortIO.ePortBidirectional);
schPort.SetState_Alignment(THorizontalAlign.eHorizontalCentreAlign);
schPort.SetState_Width(EDP.Utils.MilsToCoord(500));
schPort.SetState_AreaColor(0);
schPort.SetState_TextColor(0xFF00FF);
schPort.SetState_Name("New Port 4");
// Add a new port object in the existing schematic document.
doc.RegisterSchObjectInContainer(schPort);
schServer.GetState_RobotManager().SendMessage(doc, SCHConstant.BroadCast,
SCHConstant.SCHMPrimitiveRegistration, schPort);

See also: ISch_RobotManager

Examples: Extension_ModifySchWireColor

SchPreferences​

This Preferences property retrieves the ISch_Preferences interface which represents the Preferences object for the Schematic Editor.

ISch_Preferences GetState_SchPreferences();

Type: ISch_Preferences · Access: read-only

The accessors are extension methods of ISch_ServerInterfaceHelper (using SCH;).

Example: Turn on the watermarks for device sheets and read-only sheets.

using SCH;

ISch_Preferences preferences = SCH.GlobalVars.SchServer?.GetState_SchPreferences();
if (preferences == null)
return;
preferences.Set_WatermarkDeviceSheet(true);
preferences.Set_WatermarkReadOnlySheet(true);

See also: ISch_Preferences

Methods​

MethodReturnsDescription
CreateComponentMetafilePainterIComponentMetafilePainter
CreateComponentPainterIComponentPainterViewA IComponentPainterView interface represents the surface that a component can be painted on.
CreateDocumentPainterIDocumentPainterViewThis method retrieves the IDocumentPainterView interface that represents the Mini Viewer object in the Schematic Editor.
CreateLibCompFullInfoReaderILibCompFullInfoReader
CreateLibCompInfoReaderILibCompInfoReaderThe method returns a ILibCompInfoReader interface that represents a library component information reader object.
CreateSchLibraryISch_Lib
DestroyCompFullInfoReadervoid
DestroyCompInfoReadervoidThe method destroys an library component information reader object that is represented by the ILibCompInfoReader interface.
DestroySchLibraryvoid
DestroySchObjectvoid
DisableScrapCompilevoid
EnableScrapCompilevoid
GetCurrentSchDocumentISch_DocumentThis method returns the ISch_Document interface that represents the current schematic document open in Altium Designer.
GetSchDocumentByPathISch_Document
GetSchDocumentBySchDocIDISch_Document
LoadComponentISch_Component
LoadComponentFromDatabaseLibraryISch_Component
LoadComponentFromLibraryISch_Component
LoadDesignItemDeviceSheetISch_SheetSymbol
LoadSchDocumentByPathISch_Document
PaintComponentThumbnailuint
PaintDeviceSheetThumbnailuint
PaintLoadedComponentThumbnailuint
ReportSchObjectsDifferencesint
SchObjectFactoryISch_BasicContainerThe SchObjectFactory method creates a new object based on TObjectID and TObjectCreationMode values.
SchObjectFactoryBySettingsISch_BasicContainer
UpdateDocumentTemplatevoid
UpdateSignalValueDisplaybool

CreateComponentMetafilePainter​

No description yet.

IComponentMetafilePainter CreateComponentMetafilePainter();

Returns: IComponentMetafilePainter

Extension method of ISch_ServerInterfaceHelper (using SCH;).

See also: IComponentMetafilePainter

CreateComponentPainter​

A IComponentPainterView interface represents the surface that a component can be painted on.

IComponentPainterView CreateComponentPainter();

Returns: IComponentPainterView

Extension method of ISch_ServerInterfaceHelper (using SCH;).

This interface is a IExternalForm type which represents the TExternalFormComponent object. The TExternalForm class is defined in the ExternalForm unit from the DXP Run Time Library.

This IComponentPainterView interface is not supported in the scripting system.

This IComponentPainterView interface is for server development purposes and you need to have RT_IntegratedLIbrary, RT_Schematic, ExternalForms and the RT_ClientServerINterfaces units in a server project.

See also: IComponentPainterView

CreateDocumentPainter​

This method retrieves the IDocumentPainterView interface that represents the Mini Viewer object in the Schematic Editor.

IDocumentPainterView CreateDocumentPainter();

Returns: IDocumentPainterView

Extension method of ISch_ServerInterfaceHelper (using SCH;).

See also: IDocumentPainterView

CreateLibCompFullInfoReader​

No description yet.

ILibCompFullInfoReader CreateLibCompFullInfoReader(string argLibFileName);
ParameterTypePassing
argLibFileNamestringvalue

Returns: ILibCompFullInfoReader

Extension method of ISch_ServerInterfaceHelper (using SCH;).

CreateLibCompInfoReader​

The method returns a ILibCompInfoReader interface that represents a library component information reader object.

ILibCompInfoReader CreateLibCompInfoReader(string argLibFileName);
ParameterTypePassing
argLibFileNamestringvalue

Returns: ILibCompInfoReader

Extension method of ISch_ServerInterfaceHelper (using SCH;).

Invoke the CreateLibCompInfoReader method with the path to a schematic library and to obtain the number of components in this library, invoke the ILibCompInfoReader.NumComponentsInfos method and then to obtain the information for each component in this library invoke the ComponentInfos[] method. When you are done, invoke the DestroyCompInfoReader method.

Example: Report the components of the current schematic library.

using System.Collections.Generic;
using System.IO;
using DXP;
using SCH;

ISch_ServerInterface schServer = SCH.GlobalVars.SchServer;
if (schServer == null)
return;

ISch_Document currentLib = schServer.GetCurrentSchDocument();
if (currentLib == null)
return;
// Check whether the current document is a schematic library.
if (currentLib.GetState_ObjectId() != TObjectId.eSchLib)
{
DXP.Utils.ShowError("Please open a schematic library.", "Library components");
return;
}
string fileName = currentLib.GetState_DocumentName();

// Set up the library component reader.
ILibCompInfoReader reader = schServer.CreateLibCompInfoReader(fileName);
if (reader == null)
return;
reader.ReadAllComponentInfo();

var report = new List<string> { "Schematic Libraries and Their Components Report", "-----------------------------------------------", "" };
// Go through each component found by the reader.
int componentCount = reader.NumComponentInfos();
for (int j = 0; j < componentCount; j++)
{
IComponentInfo info = reader.GetState_ComponentInfo(j);
report.Add(fileName);
report.Add(" Name : " + info.GetState_CompName());
report.Add(" Alias Name : " + info.GetState_AliasName());
report.Add(" Part Count : " + info.GetState_PartCount());
report.Add(" Description : " + info.GetState_Description());
report.Add(" Offset : " + info.GetState_Offset());
report.Add("");
}
schServer.DestroyCompInfoReader(ref reader);

// Save the report and open it in Altium Designer.
string reportPath = Path.Combine(Path.GetTempPath(), "SchLibCompReport.txt");
File.WriteAllLines(reportPath, report);
IClient client = DXP.GlobalVars.Client;
IServerDocument document = client?.OpenDocument("Text", reportPath);
if (document != null)
client.ShowDocument(document);

See also: ILibCompInfoReader

CreateSchLibrary​

No description yet.

ISch_Lib CreateSchLibrary();

Returns: ISch_Lib

Extension method of ISch_ServerInterfaceHelper (using SCH;).

DestroyCompFullInfoReader​

No description yet.

void DestroyCompFullInfoReader(ref ILibCompFullInfoReader argLibCompReader);
void DestroyCompFullInfoReader(ref object argLibCompReader);
ParameterTypePassing
argLibCompReaderILibCompFullInfoReaderref

Returns: nothing (void)

The first overload is an extension method of ISch_ServerInterfaceHelper (using SCH;) with typed parameters; the second is declared by the interface.

DestroyCompInfoReader​

The method destroys an library component information reader object that is represented by the ILibCompInfoReader interface.

void DestroyCompInfoReader(ref ILibCompInfoReader argLibCompReader);
void DestroyCompInfoReader(ref object argLibCompReader);
ParameterTypePassing
argLibCompReaderILibCompInfoReaderref

Returns: nothing (void)

The first overload is an extension method of ISch_ServerInterfaceHelper (using SCH;) with typed parameters; the second is declared by the interface.

See also: ISch_ServerInterface.CreateLibCompInfoReader, ILibCompInfoReader

DestroySchLibrary​

No description yet.

void DestroySchLibrary(ref ISch_Lib argSchLib);
void DestroySchLibrary(ref object argSchLib);
ParameterTypePassing
argSchLibISch_Libref

Returns: nothing (void)

The first overload is an extension method of ISch_ServerInterfaceHelper (using SCH;) with typed parameters; the second is declared by the interface.

DestroySchObject​

No description yet.

void DestroySchObject(ref ISch_BasicContainer argSchObject);
void DestroySchObject(ref object argSchObject);
ParameterTypePassing
argSchObjectISch_BasicContainerref

Returns: nothing (void)

The first overload is an extension method of ISch_ServerInterfaceHelper (using SCH;) with typed parameters; the second is declared by the interface.

DisableScrapCompile​

No description yet.

void DisableScrapCompile();

Returns: nothing (void)

EnableScrapCompile​

No description yet.

void EnableScrapCompile();

Returns: nothing (void)

GetCurrentSchDocument​

This method returns the ISch_Document interface that represents the current schematic document open in Altium Designer.

ISch_Document GetCurrentSchDocument();

Returns: ISch_Document

Extension method of ISch_ServerInterfaceHelper (using SCH;).

See also: ISch_Document

Examples: Extension_CreateSchComponent, Extension_ModifySchWireColor, Extension_PlaceDeviceSheet, Extension_RemoveSchLibComponent, Extension_SupplierPreference

GetSchDocumentByPath​

No description yet.

ISch_Document GetSchDocumentByPath(string argPath);
ParameterTypePassing
argPathstringvalue

Returns: ISch_Document

Extension method of ISch_ServerInterfaceHelper (using SCH;).

Examples: Ciiva, Extension_RefreshDocument

GetSchDocumentBySchDocID​

No description yet.

ISch_Document GetSchDocumentBySchDocID(int argDocID);
ParameterTypePassing
argDocIDintvalue

Returns: ISch_Document

Extension method of ISch_ServerInterfaceHelper (using SCH;).

LoadComponent​

No description yet.

ISch_Component LoadComponent(TLibIdentifierKind argLibIdentifierKind, string argLibraryIdentifier, string argDesignItemID);
ParameterTypePassing
argLibIdentifierKindTLibIdentifierKindvalue
argLibraryIdentifierstringvalue
argDesignItemIDstringvalue

Returns: ISch_Component

Extension method of ISch_ServerInterfaceHelper (using SCH;).

Examples: Ciiva

LoadComponentFromDatabaseLibrary​

No description yet.

ISch_Component LoadComponentFromDatabaseLibrary(string argLibraryName, string argDatabaseTableName, string argDatabaseKeys);
ParameterTypePassing
argLibraryNamestringvalue
argDatabaseTableNamestringvalue
argDatabaseKeysstringvalue

Returns: ISch_Component

Extension method of ISch_ServerInterfaceHelper (using SCH;).

LoadComponentFromLibrary​

No description yet.

ISch_Component LoadComponentFromLibrary(string argLibReference, string argLibraryName);
ParameterTypePassing
argLibReferencestringvalue
argLibraryNamestringvalue

Returns: ISch_Component

Extension method of ISch_ServerInterfaceHelper (using SCH;).

LoadDesignItemDeviceSheet​

No description yet.

ISch_SheetSymbol LoadDesignItemDeviceSheet(TLibIdentifierKind argLibIdentifierKind, string argLibraryIdentifier, string argDesignItemID, int argLocationX, int argLocationY);
ParameterTypePassing
argLibIdentifierKindTLibIdentifierKindvalue
argLibraryIdentifierstringvalue
argDesignItemIDstringvalue
argLocationXintvalue
argLocationYintvalue

Returns: ISch_SheetSymbol

Extension method of ISch_ServerInterfaceHelper (using SCH;).

LoadSchDocumentByPath​

No description yet.

ISch_Document LoadSchDocumentByPath(string argFullPath);
ParameterTypePassing
argFullPathstringvalue

Returns: ISch_Document

Extension method of ISch_ServerInterfaceHelper (using SCH;).

PaintComponentThumbnail​

No description yet.

uint PaintComponentThumbnail(string argSymbolName, string argSymbolLibraryFullPath, int argPartIndex, int argWidth, int argHeight);
ParameterTypePassing
argSymbolNamestringvalue
argSymbolLibraryFullPathstringvalue
argPartIndexintvalue
argWidthintvalue
argHeightintvalue

Returns: uint

PaintDeviceSheetThumbnail​

No description yet.

uint PaintDeviceSheetThumbnail(string argDeviceSheetName, int argWidth, int argHeight);
ParameterTypePassing
argDeviceSheetNamestringvalue
argWidthintvalue
argHeightintvalue

Returns: uint

PaintLoadedComponentThumbnail​

No description yet.

uint PaintLoadedComponentThumbnail(ISch_Component argSchPart, int argPartIndex, int argWidth, int argHeight);
uint PaintLoadedComponentThumbnail(object argSchPart, int argPartIndex, int argWidth, int argHeight);
ParameterTypePassing
argSchPartISch_Componentvalue
argPartIndexintvalue
argWidthintvalue
argHeightintvalue

Returns: uint

The first overload is an extension method of ISch_ServerInterfaceHelper (using SCH;) with typed parameters; the second is declared by the interface.

ReportSchObjectsDifferences​

No description yet.

int ReportSchObjectsDifferences(ISch_BasicContainer argObject1, ISch_BasicContainer argObject2, bool argIgnoreSpatialAttributes, ref string argDiffDescription);
int ReportSchObjectsDifferences(object argObject1, object argObject2, bool argIgnoreSpatialAttributes, ref string argDiffDescription);
ParameterTypePassing
argObject1ISch_BasicContainervalue
argObject2ISch_BasicContainervalue
argIgnoreSpatialAttributesboolvalue
argDiffDescriptionstringref

Returns: int

The first overload is an extension method of ISch_ServerInterfaceHelper (using SCH;) with typed parameters; the second is declared by the interface.

SchObjectFactory​

The SchObjectFactory method creates a new object based on TObjectID and TObjectCreationMode values.

ISch_BasicContainer SchObjectFactory(TObjectId argObjectId, TObjectCreationMode argCreationMode);
ParameterTypePassing
argObjectIdTObjectIdvalue
argCreationModeTObjectCreationModevalue

Returns: ISch_BasicContainer

Extension method of ISch_ServerInterfaceHelper (using SCH;).

When you wish to create a new design object with the ISch_ServerInterface's SchObjectFactory method, you will need to have a specific design object type, assign this object with new attribute values and register this object with in the schematic document with the ISch_Document.RegisterSchObjectInContainer method.

Example: Create a port and place it on the current schematic sheet.

using DXP;
using SCH;

ISch_ServerInterface schServer = SCH.GlobalVars.SchServer;
if (schServer == null)
return;
ISch_Document document = schServer.GetCurrentSchDocument();
if (document == null)
return;

// Create a new port object.
var port = schServer.SchObjectFactory(TObjectId.ePort, TObjectCreationMode.eCreate_GlobalCopy) as ISch_Port;
if (port == null)
return;

// Set up the port; it is placed at 500, 500 mils.
port.SetState_Location(new DXP.Point(new SPoint { X = EDP.Utils.MilsToCoord(500), Y = EDP.Utils.MilsToCoord(500) }));
port.SetState_Style(TPortArrowStyle.ePortRight);
port.SetState_IOType(TPortIO.ePortBidirectional);
port.SetState_Alignment(THorizontalAlign.eHorizontalCentreAlign);
port.SetState_Width(EDP.Utils.MilsToCoord(1000));
port.SetState_AreaColor(0);
port.SetState_TextColor(0xFFFFFF);
port.SetState_Name("A new port with no net.");

// Add the port to the document and redraw the sheet.
document.RegisterSchObjectInContainer(port);
document.GraphicallyInvalidate();

See also: TObjectCreationMode

Examples: Extension_CreateSchComponent

SchObjectFactoryBySettings​

No description yet.

ISch_BasicContainer SchObjectFactoryBySettings(TObjectId argObjectId, TUnitSystem argUnit);
ParameterTypePassing
argObjectIdTObjectIdvalue
argUnitTUnitSystemvalue

Returns: ISch_BasicContainer

Extension method of ISch_ServerInterfaceHelper (using SCH;).

UpdateDocumentTemplate​

No description yet.

void UpdateDocumentTemplate(IServerDocument argDocument, string argVaultGUID, string argItemRevisionGUID);
void UpdateDocumentTemplate(object argDocument, string argVaultGUID, string argItemRevisionGUID);
ParameterTypePassing
argDocumentIServerDocumentvalue
argVaultGUIDstringvalue
argItemRevisionGUIDstringvalue

Returns: nothing (void)

The first overload is an extension method of ISch_ServerInterfaceHelper (using SCH;) with typed parameters; the second is declared by the interface.

UpdateSignalValueDisplay​

No description yet.

bool UpdateSignalValueDisplay(IDMObject argDMObject, int argValue, int argBitIndex);
bool UpdateSignalValueDisplay(object argDMObject, int argValue, int argBitIndex);
ParameterTypePassing
argDMObjectIDMObjectvalue
argValueintvalue
argBitIndexintvalue

Returns: bool

The first overload is an extension method of ISch_ServerInterfaceHelper (using SCH;) with typed parameters; the second is declared by the interface.

Returned by​

GlobalVars.SchServer

Examples​

Used in the SDK examples: Ciiva, Extension_CreateProject, Extension_CreateSchComponent, Extension_ModifySchWireColor, Extension_PlaceDeviceSheet, Extension_RefreshDocument, Extension_RemoveSchLibComponent.