PortCollection

A collection of ports.

Example

local app = cf.GetApplication()
local project = app:NewProject()

    -- Construct a port and add it to the collection

line = project.Geometry:AddLine(cf.Point(0, 0, 0), cf.Point(1, 1, 1))
port = project.Ports:AddWirePort(line.Wires[1])

    -- Obtain a handle to the 'PortCollection'

ports = project.Ports

    -- Print the number of ports in the collection

print("Number of ports in the collection is: " .. ports.Count)   

Usage locations (collections)

The following objects contain the PortCollection collection:

Property List

Count
The number of Port items in the collection. (Read only number)
Type
The object type string. (Read only string)

Method List

AddCablePort (harness CableHarness, terminal1 Terminal, terminal2 Terminal)
Add a cable port to the cable harness schematic. (Returns a CablePort object.)
AddCablePort (table table)
Create a cable port from a creation table. (Returns a CablePort object.)
AddEdgeMeshPort (positivefaces List of MeshEntity, negativefaces List of MeshEntity)
Create a port on an edge between mesh faces. (Returns a EdgeMeshPort object.)
AddEdgeMeshPort (table table)
Create a edge mesh port from a creation table. (Returns a EdgeMeshPort object.)
AddEdgeMeshPortConnectedToGround (faces List of MeshEntity, groundconnection EdgePortGroundConnectionEnum)
Create a port on an edge between mesh faces. (Returns a EdgeMeshPort object.)
AddEdgePort (positivefaces List of Face, negativefaces List of Face)
Create a port on an edge between faces. (Returns a EdgePort object.)
AddEdgePort (table table)
Create a edge port from a creation table. (Returns a EdgePort object.)
AddEdgePortConnectedToGround (faces List of Face, groundconnection EdgePortGroundConnectionEnum)
Create a port on an edge between faces. (Returns a EdgePort object.)
AddFEMLineMeshPort (startvertex MeshVertex, endvertex MeshVertex)
Create a FEM line port between two mesh vertices. (Returns a FEMLineMeshPort object.)
AddFEMLineMeshPort (table table)
Create a FEM line mesh port from a creation table. (Returns a FEMLineMeshPort object.)
AddFEMLineMeshPortBetweenPoints (start Coordinate, end Coordinate)
Create a FEM line mesh port between two points. (Returns a FEMLineMeshPort object.)
AddFEMLinePort (edges List of Edge)
Create a FEM line port along a list of edges. (Returns a FEMLinePort object.)
AddFEMLinePort (table table)
Create a FEM line port from a creation table. (Returns a FEMLinePort object.)
AddFEMLinePortBetweenPoints (start Coordinate, end Coordinate)
Create a FEM line port between two points. (Returns a FEMLinePort object.)
AddFEMModalMeshPort (vertex1 MeshVertex, vertex2 MeshVertex, vertex3 MeshVertex)
Create a FEM modal port by specifying three mesh vertices. (Returns a FEMModalMeshPort object.)
AddFEMModalMeshPort (table table)
Create a FEM model mesh port from a creation table. (Returns a FEMModalMeshPort object.)
AddFEMModalMeshPortFromPoints (corner1 Coordinate, corner2 Coordinate, corner3 Coordinate)
Create a FEM modal mesh port by specifying three points. (Returns a FEMModalMeshPort object.)
AddFEMModalPort (faces List of Face)
Create a FEM modal port on a list of faces. (Returns a FEMModalPort object.)
AddFEMModalPort (table table)
Create a FEM model port from a creation table. (Returns a FEMModalPort object.)
AddFEMModalPortFromPoints (corner1 Coordinate, corner2 Coordinate, corner3 Coordinate)
Create a FEM modal port by specifying three points. (Returns a FEMModalPort object.)
AddMicrostripMeshPort (startvertex MeshVertex, endvertex MeshVertex)
Create a microstrip port between two mesh vertices. (Returns a MicrostripMeshPort object.)
AddMicrostripMeshPort (table table)
Create a microstrip mesh port from a creation table. (Returns a MicrostripMeshPort object.)
AddMicrostripPort (edges List of Edge)
Create a microstrip port along a list of edges. (Returns a MicrostripPort object.)
AddMicrostripPort (table table)
Create a microstrip port from a creation table. (Returns a MicrostripPort object.)
AddWaveguideMeshPort (face MeshEntity, referencevector Coordinate)
Create a waveguide port on a mesh face. (Returns a WaveguideMeshPort object.)
AddWaveguideMeshPort (table table)
Create a waveguide mesh port from a creation table. (Returns a WaveguideMeshPort object.)
AddWaveguidePort (face Face)
Create a waveguide port on a face. (Returns a WaveguidePort object.)
AddWaveguidePort (table table)
Create a waveguide port from a creation table. (Returns a WaveguidePort object.)
AddWireMeshPort (segment MeshSegment)
Create a wire port on a mesh segment. (Returns a WireMeshPort object.)
AddWireMeshPort (segment MeshCurvilinearSegment)
Create a wire port on a curvilinear mesh segment. (Returns a WireMeshPort object.)
AddWireMeshPort (table table)
Create a wire mesh port from a creation table. (Returns a WireMeshPort object.)
AddWireMeshPortOnVertex (vertex MeshVertex)
Create a wire port on a mesh vertex. (Returns a WireMeshPort object.)
AddWirePort (wire Edge)
Create a port which is a point on a free wire. (Returns a WirePort object.)
AddWirePort (table table)
Create a wire port from a creation table. (Returns a WirePort object.)
Contains (label string)
Checks if the collection contains an item with the given label. (Returns a boolean object.)
Item (index number)
Returns the Port at the given index. (Returns a Port object.)
Item (label string)
Returns the Port with the given label. (Returns a Port object.)
Items ()
Returns a table of Port. (Returns a List of Port object.)
UniqueName (label string)
Generates a unique name base of of the provided base name.If the base name already exists in the collection, a digit will be appended until a valid name is generated. (Returns a boolean object.)

Index List

[number]
Returns the Port at the given index in the collection. (Read Port)
[string]
Returns the Port with the given name in the collection. (Read Port)

Property Details

Count
The number of Port items in the collection.
Type
number
Access
Read only
Type
The object type string.
Type
string
Access
Read only

Method Details

AddCablePort (harness CableHarness, terminal1 Terminal, terminal2 Terminal)
Add a cable port to the cable harness schematic.
Input Parameters
harness(CableHarness)
The cable harness to add the port to.
terminal1(Terminal)
The terminal that the components first terminal should be connected to. Can be nil.
terminal2(Terminal)
The terminal that the components second terminal should be connected to. Can be nil.
Return
CablePort
The cable port.
AddCablePort (table table)
Create a cable port from a creation table.
Input Parameters
table(table)
The creation table.
Return
CablePort
The cable port.
Example
app = cf.GetApplication()
project = app:OpenFile(FEKO_HOME..[[/shared/Resources/Automation/Cables.cfx]])

    -- Remove existing port and its nets to show how to add using the scripting methods

cableHarness = project.Cables.Harnesses["CableHarness1"]
app.Schematics:ShowCableSchematic(cableHarness)
schematicSymbolCollection = app.Schematics[1].Symbols
cablePortSymbol1 = schematicSymbolCollection:Item("Port1")
cablePortSymbol1.Terminals[1].Wires[1]:Delete()
cablePortSymbol1.Terminals[2].Wires[1]:Delete()
project.Ports[1]:Delete()

    -- Add a cablePort using a table of properties

properties = cf.CablePort.GetDefaultProperties()
properties.Label = "Port2"
properties.Harness = cableHarness
project.Ports:AddCablePort(properties)

    -- Connect the cablePort to the relevant cable connectors

schematicSymbolCollection = app.Schematics[1].Symbols
cablePortSymbol2 = schematicSymbolCollection:Item("Port2")
cablePortSymbol2.Position.X = -140
cablePortSymbol2.Position.Y = -20
cablePortSymbol2:Rotate()
terminal1 = cableHarness.Connectors["CableConnector1"].Pins["Pin1"].Terminal
terminal2 = cableHarness.Connectors["CableConnector1"].Pins["Pin2"].Terminal
cablePortSymbol2.Terminals[1]:ConnectTo(terminal1)
cablePortSymbol2.Terminals[2]:ConnectTo(terminal2)

    -- Add a voltageSource with a magnitude of 1, 50 Ohm impedance and zero phase

properties = cf.VoltageSource.GetDefaultProperties()
properties.Label = "VoltageSource2"
properties.Terminal = project.Ports["Port2"].Terminal
project.SolutionConfigurations["StandardConfiguration1"].Sources:AddVoltageSource(properties)
AddEdgeMeshPort (positivefaces List of MeshEntity, negativefaces List of MeshEntity)
Create a port on an edge between mesh faces.
Input Parameters
positivefaces(List of MeshEntity)
The list of faces on the positive side of the port.
negativefaces(List of MeshEntity)
The list of faces on the negative side of the port.
Return
EdgeMeshPort
The edge mesh port.
AddEdgeMeshPort (table table)
Create a edge mesh port from a creation table.
Input Parameters
table(table)
The creation table.
Return
EdgeMeshPort
The edge mesh port.
AddEdgeMeshPortConnectedToGround (faces List of MeshEntity, groundconnection EdgePortGroundConnectionEnum)
Create a port on an edge between mesh faces.
Input Parameters
faces(List of MeshEntity)
The list of mesh faces connecting the non-ground side of the port.
groundconnection(EdgePortGroundConnectionEnum)
Definition of whether the positive or negative terminal should be connected to ground.
Return
EdgeMeshPort
The edge mesh port.
AddEdgePort (positivefaces List of Face, negativefaces List of Face)
Create a port on an edge between faces.
Input Parameters
positivefaces(List of Face)
The list of faces on the positive side of the port.
negativefaces(List of Face)
The list of faces on the negative side of the port.
Return
EdgePort
The edge port.
AddEdgePort (table table)
Create a edge port from a creation table.
Input Parameters
table(table)
The creation table.
Return
EdgePort
The edge port.
AddEdgePortConnectedToGround (faces List of Face, groundconnection EdgePortGroundConnectionEnum)
Create a port on an edge between faces.
Input Parameters
faces(List of Face)
The list of faces connecting the non-ground side of the port.
groundconnection(EdgePortGroundConnectionEnum)
Definition of whether the positive or negative terminal should be connected to ground.
Return
EdgePort
The edge port.
AddFEMLineMeshPort (startvertex MeshVertex, endvertex MeshVertex)
Create a FEM line port between two mesh vertices.
Input Parameters
startvertex(MeshVertex)
The mesh vertex for the port start position.
endvertex(MeshVertex)
The mesh vertex for the port end position.
Return
FEMLineMeshPort
The FEM line mesh port.
AddFEMLineMeshPort (table table)
Create a FEM line mesh port from a creation table.
Input Parameters
table(table)
The creation table.
Return
FEMLineMeshPort
The FEM line mesh port.
AddFEMLineMeshPortBetweenPoints (start Coordinate, end Coordinate)
Create a FEM line mesh port between two points.
Input Parameters
start(Coordinate)
The start point of the port.
end(Coordinate)
The end point of the port.
Return
FEMLineMeshPort
The FEM line mesh port.
AddFEMLinePort (edges List of Edge)
Create a FEM line port along a list of edges.
Input Parameters
edges(List of Edge)
The edges on which the FEM line port is located.
Return
FEMLinePort
The FEM line port.
AddFEMLinePort (table table)
Create a FEM line port from a creation table.
Input Parameters
table(table)
The creation table.
Return
FEMLinePort
The FEM line port.
AddFEMLinePortBetweenPoints (start Coordinate, end Coordinate)
Create a FEM line port between two points.
Input Parameters
start(Coordinate)
The start point of the port.
end(Coordinate)
The end point of the port.
Return
FEMLinePort
The FEM line port.
AddFEMModalMeshPort (vertex1 MeshVertex, vertex2 MeshVertex, vertex3 MeshVertex)
Create a FEM modal port by specifying three mesh vertices.
Input Parameters
vertex1(MeshVertex)
The first mesh of the port.
vertex2(MeshVertex)
The second mesh vertex of the port.
vertex3(MeshVertex)
The third mesh vertex of the port.
Return
FEMModalMeshPort
The FEM modal mesh port.
AddFEMModalMeshPort (table table)
Create a FEM model mesh port from a creation table.
Input Parameters
table(table)
The creation table.
Return
FEMModalMeshPort
The FEM modal mesh port.
AddFEMModalMeshPortFromPoints (corner1 Coordinate, corner2 Coordinate, corner3 Coordinate)
Create a FEM modal mesh port by specifying three points.
Input Parameters
corner1(Coordinate)
The first corner point of the port.
corner2(Coordinate)
The second corner point of the port.
corner3(Coordinate)
The third corner point of the port.
Return
FEMModalMeshPort
The FEM modal mesh port.
AddFEMModalPort (faces List of Face)
Create a FEM modal port on a list of faces.
Input Parameters
faces(List of Face)
The faces on which the FEM modal port is located.
Return
FEMModalPort
The FEM modal port.
AddFEMModalPort (table table)
Create a FEM model port from a creation table.
Input Parameters
table(table)
The creation table.
Return
FEMModalPort
The FEM modal port.
AddFEMModalPortFromPoints (corner1 Coordinate, corner2 Coordinate, corner3 Coordinate)
Create a FEM modal port by specifying three points.
Input Parameters
corner1(Coordinate)
The first corner point of the port.
corner2(Coordinate)
The second corner point of the port.
corner3(Coordinate)
The third corner point of the port.
Return
FEMModalPort
The FEM modal port.
AddMicrostripMeshPort (startvertex MeshVertex, endvertex MeshVertex)
Create a microstrip port between two mesh vertices.
Input Parameters
startvertex(MeshVertex)
The mesh vertex for the port start position.
endvertex(MeshVertex)
The mesh vertex for the port end position.
Return
MicrostripMeshPort
The microstrip mesh port.
AddMicrostripMeshPort (table table)
Create a microstrip mesh port from a creation table.
Input Parameters
table(table)
The creation table.
Return
MicrostripMeshPort
The microstrip mesh port.
AddMicrostripPort (edges List of Edge)
Create a microstrip port along a list of edges.
Input Parameters
edges(List of Edge)
The edges on which the microstrip port is located.
Return
MicrostripPort
The microstrip port.
AddMicrostripPort (table table)
Create a microstrip port from a creation table.
Input Parameters
table(table)
The creation table.
Return
MicrostripPort
The microstrip port.
AddWaveguideMeshPort (face MeshEntity, referencevector Coordinate)
Create a waveguide port on a mesh face.
Input Parameters
face(MeshEntity)
The mesh face on which the waveguide port is located.
referencevector(Coordinate)
The waveguide reference direction.
Return
WaveguideMeshPort
The waveguide mesh port.
AddWaveguideMeshPort (table table)
Create a waveguide mesh port from a creation table.
Input Parameters
table(table)
The creation table.
Return
WaveguideMeshPort
The waveguide mesh port.
AddWaveguidePort (face Face)
Create a waveguide port on a face.
Input Parameters
face(Face)
The face on which the waveguide port is located.
Return
WaveguidePort
The waveguide port.
AddWaveguidePort (table table)
Create a waveguide port from a creation table.
Input Parameters
table(table)
The creation table.
Return
WaveguidePort
The waveguide port.
AddWireMeshPort (segment MeshSegment)
Create a wire port on a mesh segment.
Input Parameters
segment(MeshSegment)
The mesh segment the port is located on.
Return
WireMeshPort
The wire port.
AddWireMeshPort (segment MeshCurvilinearSegment)
Create a wire port on a curvilinear mesh segment.
Input Parameters
segment(MeshCurvilinearSegment)
The curvilinear mesh segment the port is located on.
Return
WireMeshPort
The wire port.
AddWireMeshPort (table table)
Create a wire mesh port from a creation table.
Input Parameters
table(table)
The creation table.
Return
WireMeshPort
The wire mesh port.
AddWireMeshPortOnVertex (vertex MeshVertex)
Create a wire port on a mesh vertex.
Input Parameters
vertex(MeshVertex)
The mesh vertex the port is located on.
Return
WireMeshPort
The wire mesh port.
AddWirePort (wire Edge)
Create a port which is a point on a free wire.
Input Parameters
wire(Edge)
The wire the port is located on.
Return
WirePort
The wire port.
AddWirePort (table table)
Create a wire port from a creation table.
Input Parameters
table(table)
The creation table.
Return
WirePort
The wire port.
Contains (label string)
Checks if the collection contains an item with the given label.
Input Parameters
label(string)
The label of the Port.
Return
boolean
The success of the check.
Item (index number)
Returns the Port at the given index.
Input Parameters
index(number)
The index of the Port.
Return
Port
The Port at the given index.
Item (label string)
Returns the Port with the given label.
Input Parameters
label(string)
The label of the Port.
Return
Port
The Port with the given label.
Items ()
Returns a table of Port.
Return
List of Port
A table of Port.
UniqueName (label string)
Generates a unique name base of of the provided base name.If the base name already exists in the collection, a digit will be appended until a valid name is generated.
Input Parameters
label(string)
The base name.
Return
boolean
The generated unique name label for Port.