LayoutHost Port and Pin Methods

These methods create and move ports/pins as needed.

MovePort(name, cx, cy, angle)

Moves an existing port of that name. All scripted footprints must call MovePort for every pin in the footprint. This call should be made prior to defining any port geometry.

Parameters:

Name: Name of the port

Cx: Center x coordinate

Cy: Center y coordinate

Angle: Rotation angle to draw port (in radians)

Example:

LayoutHost.MovePort(“1”, x, y, 2*Math.tan(theta));

SnapPort(name, edge, edge_pos, rel_angle)

Moves a port to the specified edge position. The angle is relative to the normal vector (perpendicular to the edge and pointing outwards, or to the right in poly-lines).

Parameters:

Name: Name of an existing port

Edge: The edge on which the port is to be placed

Edge_pos: The position on the edge where the port is to be placed; specified as LayoutHost.START, MID, or END (or a value < 0, 0, or > 0).

Rel_angle: An additional rotation (specified as a counter-clockwise rotation in radians) relative to the normal vector for the edge.

Example:

LayoutHost.SnapPort(“1”, rect1.Edge(1), LayoutHost.MID, 0);

SetPortLayers(name, start_layer, end_layer)

Sets the layer range (and hence placement) for a port

Parameters:

Name: Name of the port

Start_layer: An integer id retrieved from GetLayerID

End_layer: An integer id retrieved from GetLayerID

Example:

var top = LayoutHost.GetLayerId(“top”);

var bottom = LayoutHost.GetLayerId(“bottom”);

LayoutHost.SetPortLayers(“a”, top, bottom);

AddPortEdge (layer, name, points)

Defines the edge of the port to the polyline defined by “points”. Defining the port edge is necessary for co-simulation of a scripted footprint. Note, if you define the port edge, you must also have set the port position via “MovePort” first. Multiple edges may be added by calling this function repeatedly.

The points for the edge should be defined with the port as the origin. For example, if the edge is a vertical line 10 mils long running thru the port, the two points defining the edge is (0, 5) & (0, -5), regardless of the location of the port itself.

Parameters:

Layer: In integer id retrieved from GetLayerID

Name: Name of the port

Points: A PointsObject populated with the points appropriate

Example:

LayoutHost.AddPortEdge(layerID, “n1”, pts));

SetPortWidth (layer, name, w)

Defines the edge of the port to be a single line segment of width “w”, centered on the port position, and rotated to the port angle. This function is an alternate means of defining a port edge. Defining the port edge is necessary for co-simulation of a scripted footprint. Note, if you define the port edge, you must also have set the port position via “MovePort” first.

Parameters:

Layer: An integer id retrieved from GetLayerID

Name: Name of the port

W: Width of the port edge

Example:

LayoutHost.SetPortWidth(layerID, “n1”, w));