The procedure for requesting AWR support has changed. Please read all about the new AWR product support process.
##### Page tree
Go to start of banner

# Scripting How-To: How Can I Create a Shape Associated with a Physical Net

The PhysicalNet object contains a shapes collection which represents layout shapes that are associated with that PhysicalNet. This collection contains methods for adding a number of generic shapes to the collection and associating them with the PhysicalNet.

MethodDescription
PhysicalNet.Shapes.AddRectangle()Adds a rectangle with the lower left corner at the given x and y and a specified height and width
PhysicalNet.Shapes.AddPath()Adds a path with the specified segment vertices and a given path width

Table 1: Shape Add methods on PhysicalNet shapes collection

Initially, we'll start with a project that contains two lines with a single connection forming a single physical net. The layout for this looks like Figure 1.

Figure 1 Layout before adding the net associated shapes

Let's take a look at three subroutines which use these methods:

' Add a rectangle to the physical net's shapes collection.
phys.Shapes.AddRectangle(0, 0, 200e-6, 200e-6, "Thick Metal Line", True)
End Sub

This first method creates a rectangle with the lower left corner at x=0, y=0 and a height and width of 200um. The value passed as the layerName is "Thick Metal Line" which is the process line type because the last argument indicates True that we want to use process layers. This will create a rectangle shape that uses the process line type "Thick Metal Line" from (0,0) to (200um,200um). The resulting layout has the flight line connection replaced by a rectangular shape shown in Figure 2:

Figure 2 Layout after calling AddRectangle.

Next we'll look at the code for a method that creates a Polygon shape:

' Add a polygon to the physical net's shapes collection.
Dim x As Double, y As Double

' Define 8 values [0..7] for 4 points
Dim pts(7) As Double
x = 0
y = 200e-6

pts(0) = x
pts(1) = y
y = y - 200e-6
pts(2) = x
pts(3) = y
x = x + 200e-6
pts(4) = x
pts(5) = y
y = y + 200e-6
pts(6) = x
pts(7) = y

' Create the polygon using the points
End Sub

In this code we start by defining a single dimensional array of doubles that will hold the x and y values for the vertex points of the polygon. Here we want to add 4 points so we'll need 8 values. The dimension provided in basic defines the upper index bound so for our 8 value range we want the index range of [0..7], so we provide a value of 7 to the dimension call. Next we proceed to fill out the points. So that I can keep track of things I like to define variables for x and y which define the current point. In this case we will create a polygon that covers the same areas as the rectangle created in the first example. Here we enter the points (0,200), (0,0), (200,0), and (200, 200). Note we don't need to add the closing side back to (0,200) because the shape will be closed automatically. Once the points have been set we pass the array along with the "Thick Metal Line" line type and True indicating that we want to use the process layers so the layer name represents the line type. This will create a rectangular polygon over the area (0,0) to (200,200) in the design and associate it with the given physical net. The results of calling this method on the initial layout are shown in Figure 3:

Figure 3 Layout after calling AddPolygon

Next we look at creating a path shape:

' Add a path to the physical net's shapes collection.
Dim x As Double, y As Double

' Define 8 values [0..7] for 4 points.
Dim pts(7) As Double
x = 0
y = 20e-6

pts(0) = x
pts(1) = y
x = x + 100e-6
pts(2) = x
pts(3) = y
y = y + 100e-6
pts(4) = x
pts(5) = y
x = x + 100e-6
pts(6) = x
pts(7) = y

' Create the path using the points.
phys.Shapes.AddPath(pts, 20e-6, mwPET_Flush, mwPMT_Mitered, 1, "Thick Metal Line", True)

End Sub

Creating the path is similar to the polygon in that first we need to create an array for the values which will represent the segments in the path. The values provided will be the end points for the centerline segments of the path. In this case we are going to add a 3 segment path, which will require specifying 4 points, two end points and two bend vertices. So again the index range for our 8 values will be [0..7], so we provide a value of 7 to the dimension call. Next I define an x and y value to keep track of the current point and move the values. In this case I want to connect the end of the path to an existing line, which has a center line at 20um in the y direction and starts at x=0. The first segment goes horizontally from 0 to 100um. Then we add a vertical segment from 20um up to 120um by increasing y by 100um. Next we add one final horizontal segment from 100um to 200um by increasing x by 100um. When we add the path with the AddPath() call provide the vertices, a width value of 20um, indicate that the path ends should be flush, the bend style is mitered, with a miter amount of 1. The path should be placed on line type "Thick Metal Line" using the process layers. The results of calling this method on the initial layout are shown in Figure 4:

Figure 4 Layout after calling AddPath

The following example provides a complete program which demonstrates the use of these routines:

' Example add shapes to physical net in layout.
Sub Main
Dim lay As Layout
Dim phys As PhysicalNet

Set lay = Project.Schematics("Schematic 1").Layout
Set phys = lay.PhysicalNets(1)

' Uncomment one of these to create a specific shape type on the net.

End Sub

' Add a rectangle to the physical net's shapes collection.
phys.Shapes.AddRectangle(0, 0, 200e-6, 200e-6, "Thick Metal Line", True)
End Sub

' Add a polygon to the physical net's shapes collection.
Dim x As Double, y As Double

' Define 8 values [0..7] for 4 points
Dim pts(7) As Double
x = 0
y = 200e-6

pts(0) = x
pts(1) = y
y = y - 200e-6
pts(2) = x
pts(3) = y
x = x + 200e-6
pts(4) = x
pts(5) = y
y = y + 200e-6
pts(6) = x
pts(7) = y

' Create the polygon using the points
End Sub

' Add a path to the physical net's shapes collection.
Dim x As Double, y As Double

' Define 8 values [0..7] for 4 points.
Dim pts(7) As Double
x = 0
y = 20e-6

pts(0) = x
pts(1) = y
x = x + 100e-6
pts(2) = x
pts(3) = y
y = y + 100e-6
pts(4) = x
pts(5) = y
x = x + 100e-6
pts(6) = x
pts(7) = y

' Create the path using the points.
phys.Shapes.AddPath(pts, 20e-6, mwPET_Flush, mwPMT_Mitered, 1, "Thick Metal Line", True)

End Sub

A sample project with this code enclosed is available here: Create Net Shapes Example Project