Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Multidimensional Array iLogic

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
Anonymous
2352 Views, 4 Replies

Multidimensional Array iLogic

I'm trying to figure out how to create an empty 2D array in iLogic and then fill the array like a table. The VBA equivalent would go something like this:

 

Dim MyArray(0 To 1, 0 To 1) As String
MyArray(0, 0) = "00"
MyArray(0, 1) = "01"
MyArray(1, 1) = "11"
MyArray(1, 0) = "10"

MsgBox MyArray(0, 1) 'outputs string "01"

4 REPLIES 4
Message 2 of 5
JelteDeJong
in reply to: Anonymous

The ilogic/vb.net equivalent:

Dim myArray(1,1) As String
myArray(0,0) = "00"
myArray(0,1) = "01"
myArray(1,0) = "10"
myArray(1,1) = "11"
MsgBox( myArray(0, 1)) 'outputs string "01"

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 3 of 5
Anonymous
in reply to: JelteDeJong

Thank you for your reply.  I was actually able to get my original code (see below) to work. I identified the wrong problem. The problem wasn't the array, it was putting that array in a custom table (see line 23). My desired output is attached (see screen shottable screenshot.png

Sub Main 

        Dim oDrawDoc 		As DrawingDocument
	Dim oSheet 	        As Sheet
	Dim oTitles() 		As String
	Dim oContents() 	As String
	Dim oCustomTable        As CustomTable

    oDrawDoc = ThisDoc.Document
    oSheet = oDrawDoc.ActiveSheet
'    oTitles = {"DWG TYPE", "FAB STATUS", "DRAWING NUMBER", "REV. NO.", "DESCRIPTION" }
	oTitles = {"DWG TYPE", "FAB STATUS"}
    
Dim MyArray(0 To 1, 0 To 1) As Object
MyArray(0, 0) = "00"
MyArray(0, 1) = "01"
MyArray(1, 1) = "11"
MyArray(1, 0) = "10"

MsgBox("myarray(0,0) = " & myarray(0,0))

	'	oCustomTable = oPSheet.CustomTables.Add("PRINT REQUEST FORM", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), 3, 4, oTitles, oContents)	
		oCustomTable = oSheet.CustomTables.Add("Sample Table", ThisApplication.TransientGeometry.CreatePoint2d(15, 15), 2, 2, oTitles,MyArray) '''here's my problem line of code

end sub
Message 4 of 5
JelteDeJong
in reply to: Anonymous

it's maby a bit strange but you dont need a multi dimension array. The help states:

 


Optional input String array that specifies the contents of the table. The number of Strings must match the number of cells in the table, else an error will occur. This array of String is used to sequentially populate each row of the table

try the following array

Dim myArray(3) As String
myArray(0) = "00"
myArray(1) = "01"
myArray(2) = "10"
myArray(3) = "11"

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

Message 5 of 5
Anonymous
in reply to: JelteDeJong

I think I see what you're saying. It's a little counter intuitive. A multidimensional array is NOT required. The TOTAL number of cells must match the TOTAL number of data cells excluding the title cells. Thank you for clarifying that.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report