Hello,
I m having problems with the following code:
Private Sub RunScript(ByVal ptList1 As List(Of On3dPoint), ByVal ptList2 As List(Of On3dPoint), ByRef lineNet As Object)
Call Network(ptList1, ptList2)
End Sub
'<Custom additional code>
Function Network(ptList1 As list(Of On3dPoint), ptList2 As List(Of On3dPoint)) As OnLine
Dim line2 As New OnLine
Dim dist As Double 'variable to store distance between points
Dim maxDist As Double
Dim minDist As Double
maxDist = 20
minDist = 10
Dim count1 As Integer
count1 = ptList1.Count()'set length of list for loop
Dim count2 As Integer
count2 = ptList2.Count()
Dim newPtList1 As List(Of On3dPoint)
Dim newPtList2 As List(Of On3dPoint)
newPtList1 = ptList1
newPtList2 = ptList2
ptList1.RemoveAll
ptList2.RemoveAll
For i As Integer =0 To count2 - 1
For j As Integer = 0 To count1 - 1
Dim pt2 As On3dPoint
pt2 = newPtList2(i)
Dim pt1 As On3dPoint
pt1 = newPtList1(i)
dist = pt2.DistanceTo(pt1)
If (dist < maxDist & dist > minDist) Then
line2 = New OnLine(pt2, pt1)
ptList2.Add(pt1)
Else
ptList1.Add(pt1)
End If
Next
Next
Dim count As Integer
count = ptList1.Count()
If (count > 0) Then
Call Network(ptList1, ptList2, lineNet)
End If
End Function
What i have as input are two lists of points (the first one having n-items inside while the other one has only one starting point). It s supposed to work as a recursive function always returning one or more lines in the end.
The error i m getting is because of the ptList1/ptList2.RemoveAll command.
Does anyone have a clue why i can t remove the items from the lists? What i'm basically trying to do is just clean them of all content.
I've attached the def with the code as well.
Thank you in advance,
Tudor
Tags:
- Attachments:
-