Display surface while C# Grasshopper component is running

Not sure if this is such a simple question that no one needs to ask it, or if the answer is so difficult to implement that no one wants to answer it?! I want to update the Rhino document image while my C# plug-in component is running. I’m doing a Simulated Annealing optimisation of a surface (a concert hall interior geometry) that requires 400 or more grid points. That’s too many sliders for Galapagos! I’d like to see each iteration of the geometry as the optimisation algorithm progresses. Any help will be greatly appreciated. Thanks in advance.

John O’Keefe

You can use a timer.

How? Any links? Perhaps this is as simple as I suspected.

This guide might help: http://james-ramsden.com/grasshopper-ripples/

1 Like

Thanks Michael and Scott. The timer suggestion has given me a few ideas. It will take me a few days to find out if they work though. I’ll report back to the group if I find any success.

Thanks again!


I expire the solutions for this kind of things but if you are not careful you can end up crashing Rhino. If I recall correctly the method is ExpireSolution( true ) for compiled plugins and Component.ExpireSolution( true ) for the C# scripting component.

Thanks Scott. The ripples routine uses a trick that I’ve seen on the excellent course given by Long Nguyen (https://www.youtube.com/watch?v=pFCrIzENDn8.) But in both cases they’re working with the c# plug-ins on the Grasshopper canvas, which has an “extra code” section below the RunScript section. How do I do that, i.e. preserve data, from a C# plug-in that I’m writing from Visual Studio?


Write the code outside of the solve instance. That is all the additional code section is.

1 Like

As @Michael_Pryor mentioned initialize it outside the solve instance.
In the course they do the same:grafik
And afterwards you assign it in the solve instance, if you would assign it outside the solve instance you could never empty all the list,without deleting the component.

Thanks to everyone. Still working on my code but dealing with other problems now.
This has been a great help. I might also mention that Long Nguyen discusses this in his course as well. I was reviewing his lectures for the second time and had forgotten that he discusses this in the third part of the series. The link I provided above is for the second part.

Thanks again everyone!