Schematic API Functions

Old Content - visit altium.com/documentation

Parent page: Technical Reference - Schematic API

Schematic API: Functions Reference

The Schematic API Functions reference includes the following content:

SchServer Interface
General functions
Measurement Conversion functions
Conversion functions

SchServer Interface

Function SchServer : ISch_ServerInterface;

Description
The SchServer function 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

General functions

AlignToGridClosest

Function AlignToGridClosest  (AValue    : TCoord; AGridSize : TCoord) : TCoord;

AlignToGridDecrease

Function AlignToGridDecrease (AValue    : TCoord; AGridSize : TCoord) : TCoord;

AlignToGridIncrease

Function AlignToGridIncrease (AValue    : TCoord;
                              AGridSize : TCoord) : TCoord;

GetState_AllImplementations

Function GetState_AllImplementations (Const ASchComponent  : ISch_Component)       : TList;

GetState_PinsForCurrentMode

Function GetState_PinsForCurrentMode (Const ASchComponent  : ISch_Component)       : TList;

GetState_AllPins

Function GetState_AllPins            (Const ASchComponent  : ISch_Component)       : TList;

GetState_AllParameters

Function GetState_AllParameters      (Const ASchObject     : ISch_BasicContainer)  : TList;

HitTestResultToCursor

Function  HitTestResultToCursor(T : THitTestResult): TCursor;

GetDefaultSchSheetStyle

Function  GetDefaultSchSheetStyle : TSheetStyle;

GetWholeAndFractionalPart_DXP2004SP2_To_DXP2004SP1

Procedure GetWholeAndFractionalPart_DXP2004SP2_To_DXP2004SP1(ACoord : TCoord; Var AWholePart, AFractionalPart : Integer);

GetCoord_DXP2004SP1_To_DXP2004SP2

Function  GetCoord_DXP2004SP1_To_DXP2004SP2(AWholePart, AFractionalPart : Integer) : TCoord;

ConvertFileName_99SEToDXP2004

Function ConvertFileName_99SEToDXP2004(Const AOriginalName, ADocKind : TDynamicString) : TDynamicString;

GetResolvedSheetFileName

Function GetResolvedSheetFileName(Const AOriginalSFN : TDynamicString; Const AProject : IProject) : TDynamicString;

Sch_GetOwnerProject

Function Sch_GetOwnerProject(Const AContainer : ISch_BasicContainer) : IProject;

Measurement Conversion functions

//Imperial functions
Function  CoordToMils        (    C : TCoord) : TReal;
Function  CoordToDxps        (    C : TCoord) : TReal;
Function  CoordToInches      (    C : TCoord) : TReal;
Function  MilsToCoord        (    M : TReal)  : TCoord;
Function  DxpsToCoord        (    M : TReal)  : TCoord;
Function  InchesToCoord      (    M : TReal)  : TCoord;
 
//Metric functions
Function  CoordToMMs         (    C : TCoord) : TReal;
Function  CoordToCMs         (    C : TCoord) : TReal;
Function  CoordToMs          (    C : TCoord) : TReal;
Function  MMsToCoord         (    M : TReal)  : TCoord;
Function  CMsToCoord         (    M : TReal)  : TCoord;
Function   MsToCoord         (    M : TReal)  : TCoord;
 
Function  MetricString(Var S : TDynamicString; DefaultUnits : TUnit) : Boolean;
Function  ImperialString(Var S : TDynamicString; DefaultUnits : TUnit) : Boolean;
 
Function  CoordUnitToString       (C : TCoord; U : TUnit) : TDynamicString;
 
Function  CoordUnitToStringWithAccuracy  (ACoord         : TCoord;
                                          AUnit          : TUnit;
                                          ARounding      : Integer;
                                          AFixedDecimals : Integer) : TDynamicString;
 
Function  ExtractValueAndUnitFromString(AInString : TDynamicString;
                                        ADefaultUnit : TUnit;
                                    Var AValue       : TDynamicString;
                                    Var AUnit        : TUnit) : Boolean;
 
Function  StringToCoordUnit       (S : TDynamicString; Var C : TCoord; ADefaultUnit : TUnit) : Boolean;
 
Function  CoordUnitToString       (C : TCoord; U : TUnit) : TDynamicString;
 
Function  CoordUnitToStringFixedDecimals (C : TCoord; U : TUnit; AFixedDecimals : Integer) : TDynamicString;
 
Function  CoordUnitToStringNoUnit (C : TCoord; U : TUnit) : TDynamicString;
Function  CoordUnitToStringWithAccuracy  (ACoord         : TCoord;
                                          AUnit          : TUnit;
                                          ARounding      : Integer;
                                          AFixedDecimals : Integer) : TDynamicString;
 
Function  GetDisplayStringFromLocation(ALocation : TLocation; AUnit : TUnit) : TDynamicString;
 
Function GetCurrentDocumentUnit : TUnit;
Function GetCurrentDocumentUnitSystem : TUnitSystem;
Function GetSchObjectOwnerDocumentUnit(Const AObject : ISch_BasicContainer) : TUnit;

Conversion functions

Function  GetStateString_ObjectId                 (N : TObjectId                 ) : TString;
Function  GetStateString_HorizontalAlign          (N : THorizontalAlign          ) : TString;
Function  GetStateString_IeeeSymbol               (N : TIeeeSymbol               ) : TString;
Function  GetStateString_LeftRightSide            (N : TLeftRightSide            ) : TString;
Function  GetStateString_LineStyle                (N : TLineStyle                ) : TString;
Function  GetStateString_PinElectrical            (N : TPinElectrical            ) : TString;
Function  GetStateString_PortArrowStyle           (N : TPortArrowStyle           ) : TString;
Function  GetStateString_PortIO                   (N : TPortIO                   ) : TString;
Function  GetStateString_PowerObjectStyle         (N : TPowerObjectStyle         ) : TString;
Function  GetStateString_CrossSheetConnectorStyle (N : TCrossSheetConnectorStyle ) : TString;
Function  GetStateString_RotationBy90             (N : TRotationBy90             ) : TString;
Function  GetStateString_Justification            (N : TTextJustification        ) : TString;
Function  GetStateString_HorizontalJustification  (N : TTextJustification        ) : TString;
Function  GetStateString_VerticalJustification    (N : TTextJustification        ) : TString;
Function  GetStateString_SheetStyle               (N : TSheetStyle               ) : TString;
Function  GetStateString_Size                     (N : TSize                     ) : TString;
Function  GetStateString_Location                 (N : TLocation                 ) : TString;
Function  GetStateString_DisplayMode              (N : TDisplayMode              ) : TString;
 
Function  GetStateString_LineShape    (N : TLineShape) : TString;
Function  GetStateString_ObjectIdPlural(N : TObjectId) : TString;

Justification functions

Function  IsJustified_Left    (N : TTextJustification) : Boolean;
Function  IsJustified_HCenter (N : TTextJustification) : Boolean;
Function  IsJustified_Right   (N : TTextJustification) : Boolean;
Function  IsJustified_Bottom  (N : TTextJustification) : Boolean;
Function  IsJustified_VCenter (N : TTextJustification) : Boolean;
Function  IsJustified_Top     (N : TTextJustification) : Boolean;
Procedure GetOrdinalValueFromHorizontalJustification(J : TTextJustification;Var I : Integer);
Procedure GetOrdinalValueFromVerticalJustification  (J : TTextJustification;Var I : Integer);
Procedure GetHorizontalJustificationFromOrdinalValue(I : Integer; Var J : TTextJustification);
Procedure GetVerticalJustificationFromOrdinalValue  (I : Integer; Var J : TTextJustification);
 

You are reporting an issue with the following selected text and/or image within the active document: