The following script creates the circuit shown in the image below:
'Creates an LC circuit with 4 inductors and 4 capacitors
Sub Main
Dim blockName As String, blockType As String
Dim x As Integer, y As Integer, angle As Integer
For I=1 To 8
'I is odd: Inductor
'I is even: Capacitor rotated by 90°
If I Mod 2 Then
blockName = "Inductor" + CStr((I+1)/2)
blockType = "CircuitBasic\Inductor"
x = 54525+(I-1)/2*250
y = 55000
angle = 0
Else
blockName = "Capacitor" + CStr(I/2)
blockType = "CircuitBasic\Capacitor"
x = x+100
y = 5150
angle = 90
End If
With Block
.Reset
.Type blockType
.Name blockName
.Position (x,y)
.Create
If angle Then .Rotate (angle)
End With
'Connection lines
With Link
If I Mod 2 Then
If I>2 Then
'Connection of two inductors
.Reset
.SetSourcePortFromBlockPort (blockName, "1", False)
.SetTargetPortFromBlockPort ("Inductor" + CStr((I-1)/2), "2", False)
.Create
End If
'Setting source port for connection of inductor and capacitor
.Reset
.SetSourcePortFromBlockPort (blockName, "2", False)
Else
'Establishing connection of inductor and capacitor
.SetTargetPortFromBlockPort (blockName, "1", False)
.Create
End If
End With
Next I
End Sub