List of Vectors

List of Vectors

Anonymous
Not applicable
634 Views
2 Replies
Message 1 of 3

List of Vectors

Anonymous
Not applicable

I want to create a list of an unknown quantity of (preferably) 2D Vectors (but 3D works as well)

Something along the lines below:

Dim MyList As New List (Of Vector)
MyList.Add(1, 2)
MyList.Add(3, 7)
MyList.Add(5, 10)
Logger.Info(MyList(1).X)

 But this throws an error on Line 1, saying "Type 'Vector' is not defined."

0 Likes
Accepted solutions (1)
635 Views
2 Replies
Replies (2)
Message 2 of 3

johnsonshiue
Community Manager
Community Manager

Hi! Could you try "Vector2" instead?

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 3 of 3

ianteneth
Advocate
Advocate
Accepted solution

Hi @Anonymous,

 

This was very non-intuitive compared to the other language's APIs, but I think I figured out how to use vectors in iLogic. This code below worked for me. It appears that "Vector" in iLogic is "DocumentUnitsVector"? Below is a link to the iLogic API documentation, for 2019 at least. Hope this helps!

 

Dim MyList As New List (Of DocumentUnitsVector)
MyList.Add(ThisDoc.Geometry.Vector(1, 2, 3))
MyList.Add(ThisDoc.Geometry.Vector(4, 5, 6))
MyList.Add(ThisDoc.Geometry.Vector(7, 8, 9))
MessageBox.Show(MyList(1).X)

 

http://help.autodesk.com/view/INVNTOR/2019/ENU/?guid=d461dadb-afca-13e4-813e-87938b5cdff7