Hi,
I would like to return multiple objects from a function. can it be done? and how?
function DrawLines()as object
objline1 as new line
objline2 as new line
[..]
return 'objects'
end function
sub Main
Dim Group1 as new Arraylist
Group1.Add(DrawLines())
end sub
kind regards Wouter
Solved! Go to Solution.
Solved by wbdehaan. Go to Solution.
Hello!
I think the simplyest way to do it is to return an array of lines (or entityes) from your function:
Function DrawLines()as line()
Dim ArOut() As line
[···]
Rerutn ArOut
End Function
But you may also return a "collection", a "list (Of line)" or another thing...
Hope this helps!
Thanx a lot!
it helped, and i created now an arraylist to return the objects:
Public Function Drawlines() As ArrayList Dim ObjLijn1 As New Line Dim ObjLijn2 As New Line Dim Lijst As New ArrayList ObjLijn1.StartPoint = New Point3d(CenterX + F1, CenterY + Grootte / 2, 0) ObjLijn1.EndPoint = New Point3d(CenterX - F1, CenterY - Grootte / 2, 0) Lijst.Add(ObjLijn1) ObjLijn2.StartPoint = New Point3d(CenterX - Grootte / 2, CenterY + F1, 0) ObjLijn2.EndPoint = New Point3d(CenterX + Grootte / 2, CenterY - F1, 0) Lijst.Add(ObjLijn2) '---Return lijst Return Lijst End Function
Can't find what you're looking for? Ask the community or share your knowledge.