Quantcast
Channel: Scripting - McNeel Forum
Viewing all articles
Browse latest Browse all 4125

Multi-Threading Point Cloud Processing

$
0
0

Peter Schmidt wrote:

Greetings All,
I have been attempting to import point clouds into Rhino.
The point cloud is a scanned building facade, the file is over 5 GB as a .pts file.
When I attempt to open the file in Rhino it becomes unresponsive and eventually crashes.

It seems like it should be possible to write a script which reads the .pts file line by line and adds a point to the Rhino document at the appropriate location. I have devised the following script to read the large pts file one line at a time and add a point to the document.

rs.EnableRedraw(False)
with open(path) as infile:
    for line in infile:
        if line.count(" ")<=2:
            Splits=line.split(" ")
            x=float(Splits[0])
            y=float(Splits[1])
            z=float(Splits[2])
            rs.AddPoint(x,y,z)
rs.EnableRedraw(True)
print "Finished"

This script more or less works to transfer all of the points into the Rhino Document but is very time consuming. When the script is running it is using a very small percentage of the CPU available so it occurred to me that this process could be sped up by taking advantage of System.Threading.Tasks. I looked through Steve's blog post on multi-threading but I am not sure how to apply it. In his example the intersection calculation is multi-threaded while adding the curves to the document takes place on a single thread, is there a reason the points are added to the document in a single thread? I understand how multi-threading is very useful for preforming multiple independent calculations but could it be useful for something like adding 70 million points to a single document?
Thanks in advance,
5chmidt

Posts: 6

Participants: 4

Read full topic


Viewing all articles
Browse latest Browse all 4125

Trending Articles