Hi friends,
I want to divdid one curve into two groups of segments with equal lengths. So I intend to use kangaroo to do this work. But how many segments should be feed? It is hard to deside for the original curve could have different length.So I guess the Anemone would be qualified. Howerer, it seems that once Anemone finish one loop and feed one new input, Kangaroo cannot reset the sover automatically.So I need your help now and thanks in anvance. See picture and gh files below.
As pictures shows above, number 42 is what I want kangaroo&anemone give me ,but i was given number 39 instead,which is not good/right. I think the reason for this is I cannot reset kanragoo solver once anemone changed the input number,and that is why I need your help.
if I have correctly understood the problem, by looking at your definition you have a given curve to be divided into 3 groups of segments, A, B, C such as:
number of segments in A = number of segments in C (decided by you)
length of segments in B is fixed (decided by you)
segments in A and C have all same (residual) length
what I don’t really get is the involvement of the loop in this
maybe you have a max length of segments in A and C, so you want to add/remove points to group B until you get A and C in the desired threshold?
I have a lot of curves with different lengths. every curve should be devided into different number of segements. In fact, the above gh def is just one nested loop.If this loop with only one curve works and then I can add one other loop to do the same things with all the curves.
Thanks for your quick replay.
Yes,you understand my question correctly. And some more info: I want part B=2m,then part A cannot be designated to exactlly 2m. So if Part A equals ,for example, 2.1m is good enough.Once the curve given, How many segments should be the input? Then I think anemone could try different nunbers, and once the length the segments in group of part A fet my need, the loops end.
Once one curve is divided correctly, I can use nested loop to handle as many curve as I want.
In fact, in my def, number 42 is one good enough result.However, for kangaroo cannot reset automatically, my def cannot generate the right number I want.
_ first loop: feed a single curve (from a List) to next loop (just a counter, from 0 to Length(List)-1)
___ second loop: take the curve supplied by outer loop, divide it by n points, check lengths:
_____ if length is ok, trigger previous loop to feed a new curve and restart
_____ if length is not ok, retrigger second loop with number of points n-1
how to chose n in first place? considering that for a given curve, when you Polyline it, the Polyline representing it will be (equal in the worst case but most probably) shorter than the original curve
this means that dividing the length of the original curve by the desired length of the final segments would be a “safe place” to start with… then decreasing n by 1 each step, you will get increasingly longer A_and_C segments in each iteration
the problem of resetting the Kangaroo solver can be bypassed by using a Zombie solver (which -when set correctly- will only output the result of the converged solution)
Thanks. Your def is very inspiring. It seems works perfectly as I want!
you used ZombieSolver instead of the main solver,you even did not use any dam to avoid potential issues.
ZombieSolver does not output data trees so I did not use it.But it seems that ZombieSolver is better sometimes.
I will spend some time to dig into your def.Thanks again.