ISch_Label interface
The ISch_Label interface represents an existing label object on a schematic document. This interface is the ancestor interface for the ISch_NetLabel interfaces.
public interface ISch_Label : ISch_GraphicalObject
Namespace: SCH · Assembly: Altium.SDK.Interfaces
Inherits: ISch_BasicContainer → ISch_GraphicalObject
Derived: ISch_ComplexText, ISch_HarnessLayoutConnectionPoint, ISch_HarnessLayoutLabel, ISch_HarnessNoConnect, ISch_HarnessSplice, ISch_Hyperlink, ISch_NetLabel, ISch_PowerObject
Example
Set the location, color, text and font of a new label.
using SCH;
ISch_ServerInterface schServer = SCH.GlobalVars.SchServer;
ISch_Document schDoc = schServer?.GetCurrentSchDocument();
if (schDoc == null)
return;
var schLabel = schServer.SchObjectFactory(TObjectId.eLabel, TObjectCreationMode.eCreate_GlobalCopy) as ISch_Label;
if (schLabel == null)
return;
var location = new DXP.Point(new DXP.SPoint { X = EDP.Utils.MilsToCoord(1000), Y = EDP.Utils.MilsToCoord(1000) });
schLabel.SetState_Location(location);
schLabel.SetState_Color(12345);
schLabel.SetState_Text("A new name");
schLabel.SetState_FontId(schServer.GetState_FontManager().GetFontID(14, 90, false, false, false, false, "Times New Roman"));
schDoc.RegisterSchObjectInContainer(schLabel);
Properties
| Property | Type | Access | Description |
|---|---|---|---|
| CalculatedValueString | string | get | Much like the DisplayString, the CalculatedValueString contains the value of the parameter text after special string evaluation. |
| DisplayString | string | get | The DisplayString is the text displayed on the schematic after special string evaluation. |
| FontId | int | get; set | The FontID property determines the style and type of font for the ISch_Label object on a Schematic document. |
| Formula | string | get | |
| IsMirrored | bool | get; set | |
| Justification | TTextJustification | get; set | The Justification property determines the alignment of the text in respect to the Label object whether it is left justified, centered and so on. |
| Orientation | TRotationBy90 | get; set | This Orientation property determines the angle the ISch_Label is at on the Schematic document. |
| OverrideDisplayString | string | get; set | The OverrrideDisplayString property determines the override display string which overrides the Name string. |
| SimpleCalculatedString | string | get |
CalculatedValueString
Much like the DisplayString, the CalculatedValueString contains the value of the parameter text after special string evaluation. However, unlike the DisplayString, it does not include the parameter name, even if that is visible on the schematic.
string GetState_CalculatedValueString();
Type: string · Access: read-only
DisplayString
The DisplayString is the text displayed on the schematic after special string evaluation. It is used in the compiled project, and will include the parameter name at the beginning of the string in the form 'Name:' if the parameter name is visible on the schematic.
string GetState_DisplayString();
Type: string · Access: read-only
FontId
The FontID property determines the style and type of font for the ISch_Label object on a Schematic document.
int GetState_FontId();
void SetState_FontId(int argFontId);
Type: int · Access: read/write
See also: ISch_FontManager
Formula
No description yet.
string GetState_Formula();
Type: string · Access: read-only
IsMirrored
No description yet.
bool GetState_IsMirrored();
void SetState_IsMirrored(bool argValue);
Type: bool · Access: read/write
Justification
The Justification property determines the alignment of the text in respect to the Label object whether it is left justified, centered and so on.
TTextJustification GetState_Justification();
void SetState_Justification(TTextJustification argValue);
Type: TTextJustification · Access: read/write
The accessors are extension methods of ISch_LabelHelper (using SCH;).
See also: TTextJustification
Orientation
This Orientation property determines the angle the ISch_Label is at on the Schematic document. The angle is in 90 degree increments - 0, 90, 180, 270.
TRotationBy90 GetState_Orientation();
void SetState_Orientation(TRotationBy90 argRotation);
Type: TRotationBy90 · Access: read/write
The accessors are extension methods of ISch_LabelHelper (using SCH;).
However if you are using the FontID property to be assigned by the ISch_ServerInterface.FontManager then you will need to set the Orientation property as well as passing in the same rotation parameter for the ISch_FontManager.GetFontID method.
OverrideDisplayString
The OverrrideDisplayString property determines the override display string which overrides the Name string. This is similar to the DisplayString, except that it is used in compiled projects which use board level annotation or assembly variants. In those cases, it will include the new value that has been set by the user for that variant/annotation.
string GetState_OverrideDisplayString();
void SetState_OverrideDisplayString(string argS);
Type: string · Access: read/write
SetState_OverrideDisplayString methods.
SimpleCalculatedString
No description yet.
string GetState_SimpleCalculatedString();
Type: string · Access: read-only
Inherited members
- From ISch_GraphicalObject: AddErrorString, AreaColor, BoundingRectangle, BoundingRectangle_Full, Color, CompilationMasked, Dimmed, Disabled, DisplayError, EnableDraw, ErrorColor, ErrorKind, ErrorString, GetHash, GraphicallyInvalidate, LiveHighlightValue, Location, Mirror, MoveByXY, MoveToXY, OwnerPartDisplayMode, OwnerPartId, ResetErrorFields, RotateBy90, Selection, SetState_xSizeySize
- From ISch_BasicContainer: AddAndPositionSchObject, AddSchObject, CopyTo, DeleteAll, DescriptionString, ExportToParameters, FreeAllContainedObjects, Handle, IdentifierString, Import_FromUser, ObjectId, OwnerSchDocument, RemoveSchObject, Replicate, SchBasicContainer, SchIterator_Create, SchIterator_Destroy, SchParameterByName, Setstate_Default, Text, UniqueId, WiringDiagramOriginUniqueId