##### Page tree
Go to start of banner

# Wire Schematic Elements Together

### Summary

The key to getting elements directly connected together in a schematic is to place them such that the nodes of the schematic symbol overlap one another. To do this use the coordinates from the node of an existing element to place the next element that is to be connected. This will ensure that the coordinates at which the element is placed match the coordinates of the node on the existing element to which you want to connect. Lets look at an example of creating a small two port schematic by placing elements such that they will be directly connected.

### Code Snippets

``` ' Code Module
Sub Main
Dim schem As Schematic
Dim elem1 As Element, elem2 As Element, elem3 As Element
Dim elem4 As Element, elem5 As Element

Set elem1 = schem.Elements.Add("MLIN", 0, 0)

' Add vertical element at node 2 of the horizontal segment
Set elem2 = schem.Elements.Add("MLIN", elem1.Nodes(2).x, elem1.Nodes(2).y, -90)

' Ground end

Set elem3 = schem.Elements.Add("MLIN", elem1.Nodes(2).x, elem1.Nodes(2).y)

Set elem4 = schem.Elements.Add("MLIN", elem3.Nodes(2).x, elem3.Nodes(2).y, -90)

' Ground end

Set elem5 = schem.Elements.Add("MLIN", elem3.Nodes(2).x, elem3.Nodes(2).y)

End Sub```

We start by adding a new schematic to the Project named "MySchematic".

```         ' Add a schematic

Next we place an initial element with its first node at the location x = 0, y = 0.

`' Add horizontal lead-in elementSet elem1 = schem.Elements.Add("MLIN", 0, 0)`

Since no angle is specified this element will placed with a rotation angle of 0 degrees which is horizontal for a MLIN element. Next we add a vertical MLIN element to node 3 of the first horizontal element. Note we use the reference elem1 obtained when we placed the first element to get the coordinates of the 2nd node on this element and then use this as the placement coordinates for the verticle element.

```       ' Add vertical element at node 2 of the horizontal segment
Set elem2 = schem.Elements.Add("MLIN", elem1.Nodes(2).x, elem1.Nodes(2).y, -90)

' Ground end

Likewise when we add the round to the vertical MLIN element we use the reference elem2 to get the coordinates for the second node of the vertical element to ensure the GND element will be correctly connected.

Next we add an center horizontal element to the second node of the original element we placed using the elem1 reference to get the coordinates of the second node again.

```       ' Add horizontal element
Set elem3 = schem.Elements.Add("MLIN", elem1.Nodes(2).x, elem1.Nodes(2).y)```

Following this, we add a second verticle segment and gound the end.

```       ' Add verticle element
Set elem4 = schem.Elements.Add("MLIN", elem3.Nodes(2).x, elem3.Nodes(2).y, -90)

' Ground end

And then a lead-out MLIN element.

```       ' Add lead-out element
Set elem5 = schem.Elements.Add("MLIN", elem3.Nodes(2).x, elem3.Nodes(2).y) ```

Finally to make this a complete 2-port circuit we add input and output ports to the 1st node of the lead-in element and the 2nd node of the lead-out element.

```       ' Add input/output port 