Hi ,
I am new in GH and I am trying to create two arrays with VB.
I have on Error msg and two warning as in the topic.
Can’t figure it out where the proble is.
The script is below.
Thanks,
E.T.
Private Sub RunScript(ByVal Length As Object, ByVal NoLamel As Object, ByVal CThickness As Object, ByRef A As Object, ByRef B As Object)
'A is the matrix of the indeces and B is the matric of the thickness values
Dim x ,y, z As Double
Dim i As Integer
Dim Th2 As Double
Dim A1() As Double
Dim B1() As Double
Th2 = (x - z) / (y - 1)
A1(0) = 0
A1(1) = 1
A1(2) = 2
A1(3) = 3
B1(0) = 0
B1(1) = 0
B1(2) = Th2
B1(3) = Th2
For i = 2 To 2 * y + 1
i = i + 2
If i <= y + 2 And i > y Then
A1(i) = i
A1(i + 1) = i + 1
B1(i) = B1(i - 1) + z
B1(i + 1) = B1(i - 1) + z
End If
If i > y + 2 Then
A1(i) = i
A1(i + 1) = i + 1
B1(i) = i / 2 * Th2 + z
B1(i + 1) = i / 2 * Th2 + z
End If
If i < y Then
A1(i) = i
A1(i + 1) = i + 1
B1(i) = i / 2 * Th2
B1(i + 1) = i / 2 * Th2
End If
Next
A = A1
B = B1
End Sub