I can't figure out how to get multiple coordinates into a single dimensional array in VBA to use later. Here's the part of the code where I'm adding values to a coordinate array. I couldn't figure out how to add the x,y,z data to a single dimensional array. I've tried different methods but cannot get multiple values to show even as a string.
The goal of this code is to use coordinate data to feed into another function by passing a coordinate array. In this section of code I am acquiring the coordinate data from a sketch with the vLines function that holds 6,7,8 as x,y,z data. I want to hold all of this x,y,z data in the CoordinatesArray which I'm going to access later. Should I really use another array for the xyz data or a string? What would be a good method for accessing or should I make a 4D array with coordinate number and the three positions later?
I want the coordinates array to be
coordinate(1) = x1, y1, z1
coordinate(2) = x2, y2, z2
coordinate(n) = xn, yn, zn
For i = 0 To NumLines - 1
coordx1 = (vLines(12 * i + 6))
coordy1 = (vLines(12 * i + 7))
coordz1 = (vLines(12 * i + 8))
CoordinatesArray(i) = coordx1 & "" & coordy1
'CoordinatesArray(i) = CStr(coordx1) & CStr(coordy1) & CStr(coordz1)
Debug.Print "Coordinate Array = "; CoordinatesArray(i)
Debug.Print " Line(" & i & ")"
Debug.Print " Start = (" & vLines(12 * i + 6) * 1000# & "," & vLines(12 * i + 7) * 1000# & "," & vLines(12 * i + 8) * 1000# & ") mm"
Debug.Print " End = (" & vLines(12 * i + 9) * 1000# & "," & vLines(12 * i + 10) * 1000# & "," & vLines(12 * i + 11) * 1000# & ") mm"
Next i
coordinate(1) = array(x1, y1, z1).