algorithmic modeling for Rhino
Hi,
I am doing some multi-threaded intersections(brep&surface) using C# in grasshopper following the example in http://www.nzarchitecture.com/blog/index.php/2011/05/07/threading-g...
I am now testing on very simple geometries and wish to apply the component to hundreds of geometries later on. The problem is every time I start making intersections(set the boolean toggle linked with "Go" to true), Rhino crashes after two or three seconds of no response.
Ignore those displaypipeline things which mean to visualize the offset cutting plane.
Thanks,
-Jerome
Tags:
Are you doing this in Rhino4 or Rhino5?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Hi, David
I'm doing this in Latest build of Rhino 5(2011/09/27) and with grasshopper 0.8.0052.
Thanks,
-Jerome
Hi Jerome,
sorry, there's way too much code there to debug. I've never used the ThreadPool before so this is as new to me as it would be to anyone else.
I'm no fan of static variables in conjunction with threads though, that's just asking for problems.
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Thanks, Daivid
Yes, I don't like these ThreadPool things either. The .Parallel namespace in .net 4.0 really helps a lot in the parallel programming and let me abandon ThreadPool things, but that namespace is not referenced and cannot be used in C# component in grasshopper. Seems that I have to use VS2010 to do this.
Thanks!
-Jerome
Just some minor changes and it works.
It turns out that script was throwing a NullReferenceException on a ThreadPool thread because the "result" list was not instantiated. There is a bunch of stuff you should be careful with while using threading. I am not even 100% positive I handled all cases here (also, I do not think that registering so many delegates is the best idea). Definitely it did not crash Rhino after a couple attempts.
I hope it helps getting started with multithreading a process with breps,
- Giulio
_____________
giulio@mcneel.com
McNeel Europe
Welcome to
Grasshopper
© 2025 Created by Scott Davidson.
Powered by