ISch_Port interface
A port is used to connect a net on one sheet to Ports with the same name on other sheets. Ports can also connect from child sheets to Sheet entries, in the appropriate sheet symbol on the parent sheet.
public interface ISch_Port : ISch_ParametrizedGroup
Namespace: SCH · Assembly: Altium.SDK.Interfaces
Inherits: ISch_BasicContainer → ISch_GraphicalObject → ISch_ParametrizedGroup
Remarks
The port cross referencing information for ports on different schematics linked to sheet entries of a sheet symbol can be added to schematic sheets by executing the Reports » Port Cross Reference » Add To Sheet or Add to Project command within Schematic Editor in Altium Designer.
To obtain the cross reference field of a port, the design project needs to be compiled first and then port cross-referencing information added to the project or the sheet.
Port cross references are a calculated attribute of ports, they can not be edited and are not stored with the design.
The location of each port reference is determined by the location of the port on the sheet and the position of the connecting wire.
The CrossReference property returns the name of the sheet the port is linked to and the grid where the port is located at. Example : 4 Port Serial Interface .
Properties
| Property | Type | Access | Description |
|---|---|---|---|
| Alignment | THorizontalAlign | get; set | The Alignment property determines how the port's Name is aligned with respect to the ends of the port itself. |
| AutoSize | bool | get; set | |
| BorderWidth | TSize | get; set | |
| ConnectedEnd | TPortConnectedEnd | get; set | The ConnectedEnd property determines how a port object is connected graphically with the TPortConnectedEnd type. |
| CrossRef | string | get; set | Port Cross References are text that show which schematic sheets the ports are linked to with the zone reference information in brackets. |
| FontId | int | get; set | |
| HarnessColor | int | get; set | |
| Height | int | get; set | |
| IOType | TPortIO | get; set | The IOType property defines the electrical properties of the port with the TPortIO type. |
| IsCustomStyle | bool | get | |
| Name | string | get; set | The Name property determines the name for the port object. |
| OverrideDisplayString | string | get; set | The OverrrideDisplayString property determines the override display string which overrides the Name string. |
| Style | TPortArrowStyle | get; set | The Style property determines the style of the port object. |
| TextColor | int | get; set | The TextColor property determines the color (a value of TColor type) of the Port's Name string. |
| Width | int | get; set | This SetState_Width method sets the width of the port object in a TCoord value. |
Alignment
The Alignment property determines how the port's Name is aligned with respect to the ends of the port itself. The Name string can be left justified, centered or right justified.
THorizontalAlign GetState_Alignment();
void SetState_Alignment(THorizontalAlign argValue);
Type: THorizontalAlign · Access: read/write
The accessors are extension methods of ISch_PortHelper (using SCH;).
See also: THorizontalAlign
AutoSize
No description yet.
bool GetState_AutoSize();
void SetState_AutoSize(bool argValue);
Type: bool · Access: read/write
BorderWidth
No description yet.
TSize GetState_BorderWidth();
void SetState_BorderWidth(TSize argValue);
Type: TSize · Access: read/write
The accessors are extension methods of ISch_PortHelper (using SCH;).
ConnectedEnd
The ConnectedEnd property determines how a port object is connected graphically with the TPortConnectedEnd type.
TPortConnectedEnd GetState_ConnectedEnd();
void SetState_ConnectedEnd(TPortConnectedEnd argValue);
Type: TPortConnectedEnd · Access: read/write
The accessors are extension methods of ISch_PortHelper (using SCH;).
See also: TPortConnectedEnd
CrossRef
Port Cross References are text that show which schematic sheets the ports are linked to with the zone reference information in brackets. For example a port with A[0..2] name on 4 Port UART and Line Drivers.SchDoc will have a string with "ISA and Address Decoding" and the 4C string represents the location (reference zone markers around the schematic sheet) of the matching port on ISA and Address Decoding.SchDoc. The string in the [] bracket is dependent on the Port Cross References options in the Schematic – General page of the Preferences dialog.
string GetState_CrossRef();
void SetState_CrossRef(string argValue);
Type: string · Access: read/write
Port Cross References are generated from the Reports » Port Cross Reference » Add to Sheet or Reports » Port Cross Reference » Add to Project commands in the Schematic Editor.
The CrossRef string is also represented as a parameter associated with this port object AFTER the port cross reference command from the Reports menu has been invoked.
Example: Report the cross reference of every port on the current schematic sheet.
using System.Collections.Generic;
using System.IO;
using DXP;
using SCH;
ISch_Document currentSheet = SCH.GlobalVars.SchServer?.GetCurrentSchDocument();
if (currentSheet == null)
return;
var report = new List<string>();
ISch_Iterator iterator = currentSheet.SchIterator_Create();
iterator.AddFilter_ObjectSet(new SCH.TObjectSet { TObjectId.ePort });
try
{
for (var port = iterator.FirstSchObject() as ISch_Port; port != null; port = iterator.NextSchObject() as ISch_Port)
{
if (port.GetState_CrossRef() != "")
report.Add("Port:" + port.GetState_Name() + "'s cross reference: " + port.GetState_CrossRef());
else
report.Add("Port:" + port.GetState_Name() + " does not have a cross reference.");
}
}
finally
{
currentSheet.SchIterator_Destroy(ref iterator);
}
string reportPath = Path.Combine(Path.GetTempPath(), "PortReport.txt");
File.WriteAllLines(reportPath, report);
IClient client = DXP.GlobalVars.Client;
IServerDocument reportDocument = client.OpenDocument("Text", reportPath);
if (reportDocument != null)
client.ShowDocument(reportDocument);
FontId
No description yet.
int GetState_FontId();
void SetState_FontId(int argFontId);
Type: int · Access: read/write
HarnessColor
No description yet.
int GetState_HarnessColor();
void SetState_HarnessColor(int argValue);
Type: int · Access: read/write
The accessors are extension methods of ISch_PortHelper (using SCH;).
Height
No description yet.
int GetState_Height();
void SetState_Height(int argValue);
Type: int · Access: read/write
IOType
The IOType property defines the electrical properties of the port with the TPortIO type. Available Port IO types are: Input, Output, Bi-directional and Unspecified.
TPortIO GetState_IOType();
void SetState_IOType(TPortIO argValue);
Type: TPortIO · Access: read/write
The accessors are extension methods of ISch_PortHelper (using SCH;).
The setting of this IO Type does not influence the connectivity of the circuit, but is considered during the running of an electrical rules check, which can be set to detect incompatible port directions.
See also: TPortIO
IsCustomStyle
No description yet.
bool GetState_IsCustomStyle();
Type: bool · Access: read-only
Name
The Name property determines the name for the port object.
string GetState_Name();
void SetState_Name(string argValue);
Type: string · Access: read/write
OverrideDisplayString
The OverrrideDisplayString property determines the override display string which overrides the Name string.
string GetState_OverrideDisplayString();
void SetState_OverrideDisplayString(string argValue);
Type: string · Access: read/write
Style
The Style property determines the style of the port object. This style is determined by the TPortArrowStyle type. This style defines the graphical style of the port object.
TPortArrowStyle GetState_Style();
void SetState_Style(TPortArrowStyle argValue);
Type: TPortArrowStyle · Access: read/write
The accessors are extension methods of ISch_PortHelper (using SCH;).
See also: TPortArrowStyle
TextColor
The TextColor property determines the color (a value of TColor type) of the Port's Name string.
int GetState_TextColor();
void SetState_TextColor(int argValue);
Type: int · Access: read/write
The accessors are extension methods of ISch_PortHelper (using SCH;).
The TColor value specifies a 6 digit hexadecimal number of the $FFFFFF format. For example the color blue would be RGB:0,0,255 and Hex:FF0000 therefore the converted decimal value would be 16711680. The following formula may be used to calculate the required value, R+256*(G+(256*B)).
Width
This SetState_Width method sets the width of the port object in a TCoord value. Use one of the following conversion methods to convert from a unit value to a TCoord value. For example EDP.Utils.MilsToCoord.
int GetState_Width();
void SetState_Width(int argValue);
Type: int · Access: read/write
The GetState_Width method gets the width of the port in TCoord type. Use one of the following conversion methods to convert from a TCoord value to one of these Unit values. For example EDP.Utils.CoordToMils.
Methods
| Method | Returns | Description |
|---|---|---|
| IsVertical | bool | This method returns a Boolean value that determines whether the port object is aligned vertically or not. |
IsVertical
This method returns a Boolean value that determines whether the port object is aligned vertically or not.
bool IsVertical();
Returns: bool
Inherited members
- From ISch_ParametrizedGroup: Import_FromUser_Parameters, ResetAllSchParametersPosition
- 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
Examples
Used in the SDK examples: Extension_TestPortHarnessDev.