I have been looking at the scripting examples for Kangaroo2 especially ‘custom iteration’ and ‘step by step’ from Daniel Piker (thanks!). I am wondering if it is possible to create new Goal Objects while the solver is stepping forward. Using the catenary Kangaroo example, I wanted one of the vertices in the mesh to snap to a test point when it is close enough. My first instinct was to use a magnet snap, but I couldn’t seem to get it to work. (I tried creating a list of magnet snaps, each one set between one vertex and the test point).
Above: I would like one of th e vertices to snap to the sphere as it is form-finding
Above: Creating magnet snaps
I also started looking at scripting Kangaroo as I thought it would be a more flexible method for doing some custom things. I went through all the examples and understand them well enough. However, in this case I tried to: evaluate whether each particle is close enough to the test point, and if so, create an Anchor GoalObject to clamp its position after calling PhysicalSystem.Step() each time. I did not have success with this either. Is there something I missed in my script?
Above: Edited version of step by step C# scripting example
Above: Code chunk from script. The function CheckDistance is called after PS.Step()
Above: As I step throught solver, I want to create a new anchor Goal Object at the vertex which is close enough to the sphere at this time.
Thanks for any help in advance and the grasshopper definition is attached below
Catenary_edit.gh (17.4 KB)