New Rhino.Geometry.PointCloudItem every time point is added

PointCloud.Add and PointCloud.AddRange both create a new Rhino.Geometry.PointCloudItem everytime

I’m using code like this (the add is inside some loops, but the loops are just being used to calculate the x, y, and z values):

    PointCloud pointcloud1 = new PointCloud();
    PointCloud pointcloud2 = new PointCloud();
    List<Point3d> mb = new List<Point3d>();

    #loop start
    pointcloud1.Add(new Point3d(x, y, z));
    mb.Add(new Point3d(x, y, z));
    #loop end

    pointcloud2.AddRange(mb);
    A = pointcloud1;
    B = pointcloud2;

A and B show this:

Can someone tell me why it shows one Rhino.Geometry.PointCloudItem for each point added to the pointcloud, instead of just one pointcloud object? Also, how would I fix this?

the C# component is treating PointCloud as a collection, therefore its content is automatically extracted. You need to wrap it. Try GH_ObjectWrapper

In Python using A = [pointcloud] solve the problem

1 Like

Thanks, this does work. But I have no idea now how to save this pointcloud out to use in another program.

Sorry to revive this but with Rhino8 it does not work anymore:

cloud = [cloud]

Now returns System.Collections.Generic.List1[System.Object]` and not a point cloud geometry object as before.

Any idea how to get a geometry PointCloud in GH Python again?