Project points to a polysurface

Hi,
I have to project 6-9mio points to a polysurface and export them to a pointcloud *.txt file.
When I use the _Project command it takes a very long time.
Is there a way to write a Rhino-Plugin in C# to reduce the time?

Sorry for my english, it is not the yellow of the egg :smile:

best regards,
Daniel

Yes, it can be done in c# using Brep.ClosestPoint function. Still, 6-9 mio points can take a while…
http://4.rhino3d.com/5/rhinocommon/html/M_Rhino_Geometry_Brep_ClosestPoint.htm

1 Like

Thanks.
Do you have a sample how to do this with Brep.ClosestPoint function?
I don’t know how to start with this function…

I’m not in the position to write code at the moment, sorry…

@Acid94,

below is a python example using Brep.ClosestPoint function. It took 62sec to pull a pointcloud with 10Mio points to a simple brep using 8 cpu cores. The brep i´ve tried with was just a rounded cube.

To export the resulting pointcloud as *.txt file, just use the _Export command and use the Points(.txt) extension.

PullPointCloudToBrep.py (875 Bytes)

c.

2 Likes

Hi Daniel,

Keep in mind that Brep.ClosestPoint is like the Pull command

To Project you need another function:
Rhino.Geometry.Intersect.Intersection.ProjectPointsToBreps(breps, pts, direction, tolerance)

-Willem

3 Likes

Thanks!
I think I can work with this. :wink:

Are there any books to learn more about the Rhino SDK?
Because I’m new to this and want to become better

-Daniel

Hi Daniel, below are some recources you might start with:

http://4.rhino3d.com/5/rhinocommon/index.html

btw. the remark of @Willem is correct. In case you want to project, you can find example code here.

c.

BTW: Are there recommended settings in Rhino or Windows to get more performance while projecting?

Not that i know of. But i am not shure if lowering the absolute unit tolerance or setting the option Loose=No affects projection speed. You might time it to check for a difference.

c.

1 Like

OK, I will test this.

My C# program works fine, but it is still slow…
Maybe it is possible to optimize the script…

Neues Textdokument.txt (2.1 KB)

Hi Daniel,

It is probably better to not add each point to the document individually using this line:

doc.Objects.AddPoint(point);

If you really want to create point objects, use this instead, without iterating over the points you allready have:

doc.Objects.AddPoints(points);

You might get more speed by adding a new pointcloud from the points and add the pointcloud to the document. Exporting this pointcloud using the points(.txt) extension will output the coordinates just like points do.

c.

Or make a pointcloud