Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

2 dimensional array help

Status
Not open for further replies.

Brenton

Technical User
Jul 29, 2002
43
US
I have an array Pt(7,2). How can I make that one dimensional?
 
Do you want to create 2 one dimensional arrays?

"All I ask is the chance to prove that money can't make me happy." - Spike Milligan
 
I am not completely sure of what you are trying to do but here is one idea.

Private Type MyPt
pt0 As Long
pt1 As Long
pt2 As Long
End Type


Private Sub Command1_Click()
Dim exCh As MyPt
Dim NewArr(7) As MyPt
Dim Pt(7, 2) As Long
Dim iX As Long
Dim iY As Long

For iX = 0 To 7 ' Fill the array for demo purpose
For iY = 0 To 2
Pt(iX, iY) = iX + iY
Next
Next

For iX = 0 To 7 'Convert the data over to MyPt type and add to new array
exCh.pt0 = Pt(iX, 0)
exCh.pt1 = Pt(iX, 1)
exCh.pt2 = Pt(iX, 2)
NewArr(iX) = exCh
Next

End Sub

If you choose to battle wits with the witless be prepared to lose.

[cheers]
 
Pt(7,2) is an array of 3d points.
Example
Pt(0,0) = X Value
Pt(0,1) = y value
Pt(0,2) = Z Value

I need to create a box with these points, but i am bound to my plug-in aplications abilities. I use Rhino.Addbox(Pt), but Rhino.Addbox requires a one dimensional array.

How can I make a new array
Pt(1) = x,y,z
 
Brenton,

Did you look at the code I posted? That is exactly what I provided for you. [sadeyes]

If you choose to battle wits with the witless be prepared to lose.

[cheers]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top