algorithmic modeling for Rhino
I have a simple script with one line of code. Can I make it run using parallel and how? C# or Python? For each curve there is a corresponding surface and it takes a long time with a couple hundred curves.
offsetCrv = crv.OffsetOnSurface(srf, dist, tol);
Tags:
First of all the OffsetOnSurface method must be thread-safe, which it may be, or it may not be, I'm not sure. Will you offset the same curve hundreds of times, or hundreds of different curves? Will you be using the same surface, or a different one?
There are several ways to parallelize code in C#, though it is significantly easier with the Task.Parallel library which comes with .NET 4.0 (i.e. you'll need the Rhino6 WIP). If you don't have access to the Rhino WIP, then the TreadPool class is probably your best bet.
http://robvolk.com/c-parallelism-executing-methods-in-parallel-in-n...
Welcome to
Grasshopper
© 2024 Created by Scott Davidson. Powered by