How to place Inventor Collection into ArrayList or Hashset

How to place Inventor Collection into ArrayList or Hashset

abdullah_elq
Advocate Advocate
401 Views
2 Replies
Message 1 of 3

How to place Inventor Collection into ArrayList or Hashset

abdullah_elq
Advocate
Advocate

Hi,

 

Is there any way to place all the items in an Inventor Collection into ArrayList or HashSet?

 

For Example:

 

Dim oPartDoc As PartDocument = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
Dim oSB As SurfaceBody = oCompDef.SurfaceBodies(1)
Dim oFaces As Faces = oSB.Faces

'Is there any way to place all the items in oFaces into FaceArrayList or FaceHashSet without a loop?

Dim FaceArrayList As New ArrayList
'FaceArrayList = oFaces

Dim FaceHashSet As New HashSet(Of Object)
'FaceHashSet.UnionWith(oFaces)

 

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

JelteDeJong
Mentor
Mentor
Accepted solution

try one of the following:

Dim oPartDoc As PartDocument = ThisApplication.ActiveDocument
Dim oCompDef As PartComponentDefinition = oPartDoc.ComponentDefinition
Dim oSB As SurfaceBody = oCompDef.SurfaceBodies(1)
Dim oFaces As Faces = oSB.Faces


Dim facesList = oFaces.Cast(Of Face).ToList()
Dim facesHashSet = oFaces.Cast(Of Face).ToHashSet()

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 3

abdullah_elq
Advocate
Advocate

@JelteDeJong thank you very much!

0 Likes