C# Recompute specific component

script
grasshopper
unhandled

(Shimpei) #1

Hi

How can I recompute specific component when I push the button in C# ?

Best,
Shimpei


#2

Try this:

// Rolf


(Shimpei) #3

Hi RIL,
Thank you for the reply.

I already tried your method.
However, my component has problem with something that it will calculate only when recomputed(F5).


(Vicente Soler) #4

Re-computing a component once with a button input is tricky. A component will re-compute when the input changes. When pressing and depressing a button this will happen twice.
Rather than using an input, you could just use the “Enable” button on the right click or middle mouse click menus.
You can also add a keyboard shortcut for this under Settings > Interface > Shortcuts > Enable selected.


(Andrew Heumann) #5

If you don’t need to solve it all in the same component, Metahopper can assist here, with the “Expire Object” component.


#6

Here you have a C# version of what makes Metahopper but selecting the component by its nickname.
Recompute component.gh (5.4 KB)