Copy point3dlist

Hello,

is there a method to make a copy of a Rhino.Collections.Point3dList()?
As far as i understand with Point3dList.CopyTo(…) i just can copy the list to an array.
Or have i to do it this way?:

rhino_points = rc.Collections.Point3dList()
for point in rhino_points_in:
    rhino_points.Add(point)

Thanks in advance.

Philip

Never tried it myself, but does it work if you do:

rhino_points = rc.Collections.Point3dList()
rhino_points = rhino_points_in

With Python you might want to import the module Copy and use the method:

import copy
copied_list=copy.copy(orig_list)
#or
copied_list=copy.deepcopy(orig_list)

Does that help?

Thank you for you suggestions. I tried them, but both doesn’t work on rhinos Point3dList.
But adding points to a rhino Point3dList seems to be quite fast, so i can use this without serious performance loss.
Have a nice evening!

Ah pity. I am still quite the noob when it comes to python. Does it help if you do this instead of my earlier suggestion?

rhino_points = rhino_points_in[:]

According to a quick search on the internet, this is apparently how lists are copied in python.

You can create an instance of a Point3dList from anything that represents an enumerable list of points.

import Rhino

ptlist = Rhino.Collections.Point3dList()
for x in range(10):
    for y in range(10):
        ptlist.Add(x,y,0)

# create an independent copy of ptlist
copylist = Rhino.Collections.Point3dList(ptlist)
copylist.Add(1,1,1)

print len(ptlist)
print len(copylist)