Date: Fri, 29 Mar 2024 10:03:51 +0000 (GMT) Message-ID: <145787435.155.1711706631282@[172.30.0.157]> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_154_1805010761.1711706631282" ------=_Part_154_1805010761.1711706631282 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
The key to getting elements directly connected together in a schematic i= s to place them such that the nodes of the schematic symbol overlap one ano= ther. To do this use the coordinates from the node of an existing element t= o 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 no= de on the existing element to which you want to connect. Lets look at an ex= ample of creating a small two port schematic by placing elements such that = they will be directly connected.
' C= ode Module Sub Main Dim schem As Schematic Dim elem1 As Element, elem2 As Element, elem3 As Element Dim elem4 As Element, elem5 As Element ' Add a schematic Set schem =3D Project.Schematics.Add("MySchematic") ' Add horizontal lead-in element Set elem1 =3D schem.Elements.Add("MLIN", 0, 0) ' Add vertical element at node 2 of the horizontal segment Set elem2 =3D schem.Elements.Add("MLIN", elem1.Nodes(2).x, elem1.Nodes= (2).y, -90) ' Ground end schem.Elements.Add("GND", elem2.Nodes(2).x, elem2.Nodes(2).y) ' Add horizontal element Set elem3 =3D schem.Elements.Add("MLIN", elem1.Nodes(2).x, elem1.Nodes= (2).y) ' Add verticle element Set elem4 =3D schem.Elements.Add("MLIN", elem3.Nodes(2).x, elem3.Nodes= (2).y, -90) ' Ground end schem.Elements.Add("GND", elem4.Nodes(2).x, elem4.Nodes(2).y) ' Add lead-out element Set elem5 =3D schem.Elements.Add("MLIN", elem3.Nodes(2).x, elem3.Nodes= (2).y) ' Add input/output port schem.Elements.Add("PORT", elem1.Nodes(1).x, elem1.Nodes(1).y) schem.Elements.Add("PORT", elem5.Nodes(2).x, elem5.Nodes(2).y, 180) End Sub
We start by adding a new schematic to the Project named "MySchematic".= p>
= ' Add a schematic Set schem =3D Project.Schematics.Add("MySchematic")
Next we place an initial element with its first node at the location x =3D =
0, y =3D 0.
' Add hor= izontal lead-in elementSet elem1 =3D 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 re=
ference elem1 obtained when we placed the first element to get the coordina=
tes of the 2nd node on this element and then use this as the placement coor=
dinates for the verticle element.
= ' Add vertical element at node 2 of the horizontal segment Set elem2 =3D schem.Elements.Add("MLIN", elem1.Nodes(2).x, elem1.Nodes= (2).y, -90) ' Ground end schem.Elements.Add("GND", elem2.Nodes(2).x, elem2.Nodes(2).y)
Likewise when we add the round to the vertical MLIN element we use the refe=
rence elem2 to get the coordinates for the second node of the vertical elem=
ent to ensure the GND element will be correctly connected.
Next we add an center horizontal element to the second node of the origi= nal element we placed using the elem1 reference to get the coordinates of t= he second node again.
= ' Add horizontal element Set elem3 =3D 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 =3D schem.Elements.Add("MLIN", elem3.Nodes(2).x, elem3.Nodes= (2).y, -90) ' Ground end schem.Elements.Add("GND", elem4.Nodes(2).x, elem4.Nodes(2).y)
And then a lead-out MLIN element.
= ' Add lead-out element Set elem5 =3D 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 port=
s to the 1st node of the lead-in element and the 2nd node of the lead-out e=
lement.
= ' Add input/output port schem.Elements.Add("PORT", elem1.Nodes(1).x, elem1.Nodes(1).y) schem.Elements.Add("PORT", elem5.Nodes(2).x, elem5.Nodes(2).y, 180) = pre>
The resulting circuit is shown here:
Notice how the green squares or circles appear at all the element nodes = indicating connected elements. The key to getting the connections is to use= the node coordinates for an existing element to place the next connecting = element.