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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Matrix Of Insertion Points

Status
Not open for further replies.

sgfromny

Technical User
Jan 17, 2003
120
0
0
US
Can anyone direct me in how I can store a matrix of 12 Insertion points. Currently Im doing the Following

Dim IP (12, 0 to 2) as Double
IP(1, 0) = 21.25: IP(1, 1) = 23.5: IP(1, 2) = 0
IP(2, 0) = 23.625: IP(2, 1) = 23.5: IP(2, 2) = 0
IP(3, 0) = 26: IP(3, 1) = 23.5: IP(3, 2) = 0
IP(4, 0) = 21.25: IP(4, 1) = 25.5: IP(4, 2) = 0
IP(5, 0) = 23.625: IP(5, 1) = 25.5: IP(5, 2) = 0
IP(6, 0) = 26: IP(6, 1) = 25.5: IP(6, 2) = 0
IP(7, 0) = 21.25: IP(7, 1) = 27.5: IP(7, 2) = 0
IP(8, 0) = 23.625: IP(8, 1) = 27.5: IP(8, 2) = 0
IP(9, 0) = 26: IP(9, 1) = 27.5: IP(9, 2) = 0
IP(10, 0) = 21.25: IP(10, 1) = 29.5: IP(10, 2) = 0
IP(11, 0) = 23.625: IP(11, 1) = 29.5: IP(11, 2) = 0
IP(12, 0) = 26: IP(12, 1) = 29.5: IP(12, 2) = 0


But when I call the variable in an expresstion like:
Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(IP(1), "415", 1#, 1#, 1#, 0)

I get an error - WRONG NUMBER OF DIMENSIONS

Help would be greatly appreciated
 
Hi sgfromny,

Yep - no can do. When you pass the insertion point to InsertBlock it needs to be a one dimensional array of doubles - so I usually use a loop.

In your case, you could do something like:
Code:
Dim IP (12, 0 to 2) as Double
Dim InsPt (0 to 2) As Double

IP(1, 0) = 21.25: IP(1, 1) = 23.5: IP(1, 2) = 0
IP(2, 0) = 23.625: IP(2, 1) = 23.5: IP(2, 2) = 0
IP(3, 0) = 26: IP(3, 1) = 23.5: IP(3, 2) = 0
IP(4, 0) = 21.25: IP(4, 1) = 25.5: IP(4, 2) = 0
IP(5, 0) = 23.625: IP(5, 1) = 25.5: IP(5, 2) = 0
IP(6, 0) = 26: IP(6, 1) = 25.5: IP(6, 2) = 0
IP(7, 0) = 21.25: IP(7, 1) = 27.5: IP(7, 2) = 0
IP(8, 0) = 23.625: IP(8, 1) = 27.5: IP(8, 2) = 0
IP(9, 0) = 26: IP(9, 1) = 27.5: IP(9, 2) = 0
IP(10, 0) = 21.25: IP(10, 1) = 29.5: IP(10, 2) = 0
IP(11, 0) = 23.625: IP(11, 1) = 29.5: IP(11, 2) = 0
IP(12, 0) = 26: IP(12, 1) = 29.5: IP(12, 2) = 0

InsPt(0) = IP(1,0)
InsPt(1) = IP(1,1)
InsPt(2) = IP(1,2)

Set blockRefObj = ThisDrawing.ModelSpace.InsertBlock(InsPt, "415", 1#, 1#, 1#, 0)

HTH
Todd

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top