How to creat custom bouncy Solver?

script
unhandled

(Gottfried) #1

Hi everyone,

right now I’m learning to script C# for Grasshopper and try to customize a Kangaroo solver,
which will stop after certain iterations.
LimitStep.gh (55.9 KB)

It is working but the solver output the result directly, can someone please tell me if it is possible to customize Kangaroosolver also with the Bouncy effect?
(like the bouncy solver but will stop at certain Iteration)

Thanks


(Daniel Piker) #2

Hi Gottfried,

Do you mean to output the intermediate results, not just the final one?
or specifically the bouncy effect (momentum and more oscillation)?


(Gottfried) #3

Hi Daniel,

Thanks for the reply,

I mean to output the intermediate result during the calculation, so it will be visually dynamic.
every time I used “do while” loop it will only output the final result.

I was thinking in order to do so, do I have to add a timer?


(Daniel Piker) #4

LimitStepBouncy.gh (54.9 KB)
Here’s one way to make it output intermediate results.

This one still uses a timer, which will keep running even when the solver is done. With a compiled component you could avoid the need for this, and make it stop when done by overriding AfterSolveInstance - I think there was also a way to do this within the GH script components, but can’t recall right now exactly how this was done.


(Daniel Piker) #5

I remembered now how this is done without the timer - it’s just a question of adding in an ExpireSolution like this
LimitStepBouncy2.gh (51.5 KB)


(Gottfried) #6

Thanks, Daniel! It working Great!
It really helps a lot!

By the way, could you tell me how can I add a timer in a compiled component?
I didn’t find any example on GitHub.