What I am trying to do is for Autodesk Inventor. I'm writing a program that goes iterates through a bunch of lines in a sketch. It gathers the groups of connected lines and puts them in a collection. Then it makes a collection of these collections to be processed.
I'm trying to do this by adding the lines to a temporary collection, then adding this temporary collection to the collection of loops, so that I don't have to generate an unknown amount of collections for each loop. However, as soon as I reset the temporary collection using the Clear method, it erases the information that I had just pushed into the collection of loops. Is there any way to make the information in the collections of loops independent of what is in the temporary collection?
As you can see, the issue is that I never know how many lines will be connected, so thus I never know how many sub collections there will be.
Here is the code I have.
Dim oLoopColl As New Collection
Dim oSubColl As ObjectCollection
Set oSubColl = ThisApplication.TransientObjects.CreateObjectCollection
For j = 1 To oSLColl.Count
oSubColl.Add (oSLColl.Item(j))
'Check for last item to see if it is part of the first
If j = oSLColl.Count Then
If oSLColl.Item(j).EndSketchPoint Is oSLColl.Item(1).StartSketchPoint Then
MsgBox ("Last SL is part of first coll!")
oLoopColl.Item(1).Add (oSLColl.Item(j))
oSubColl.Clear
Else
Call oLoopColl.Add(oSubColl, CStr(j))
End If
Else
If Not oSLColl.Item(j).EndSketchPoint Is oSLColl.Item(j + 1).StartSketchPoint Then
Call oLoopColl.Add(oSubColl, CStr(j))
oSubColl.Clear
End If
End If
Next
oSubColl.Clear
Set oSubColl = Nothing