I would like to create a polyline that grows along a curved path with fixed length with straight line segments of 3m and 5m segments according to a ruleset. Possibly with vectors, and when it has done 1 growth step I would like to do a check possibly just some “if” “else” “do”.
I have some issues getting started, I have done a lot of “fixed” geometry in grasshopper before - just using standard components, but I have never tried to make stuff move or grow and I have very little experience in python and none in kangaroo.
Do you have some pointers on where to start? Its a bit hard to get started with python (atleast for me), when you dont really know syntax etc. I have done some tutorials on loops. However I think I need to learn to script python to evolve my GH skillset, so this seemed like a good task to try to solve that way.
Basically the red vectors are doing what I wish to do, with a check between each growth step.
Thanks in advance
Thanks for the reply. Its not completely what I want, since that one takes the curve length but I need the polyline segments to be 3 and 5m.
Also I should mention that I have already done a script that can do this statically. - With the divide distance component.
My problem arises since I have a check that needs to be done every segment growth. The check determines if i need to use a 3m or 5m segment next time, and therefore I do not know how the geometry will end up looking. ie. if the final geometry it wil be composed as a 5m+5m+5m polyline or 3m+3m+3m+3m+3m polyline, beacause of this check and the ruleset that it should follow.
Thats why I’m asking for the growth algorithm help, i see that as the first step, then i can make the ruleset check, and make a loop that does them until I’m out of curve
Here is my bad try with Anemone 0.4
It works, but certainly not optimal. I had to go quick, couldn’t think of another way, but i’m sure there is tons of better and simplier way with anemone
At least you get the idea…
EDIT : I assumed you wanted the polyline segments to match your length… Is it corect? Or you wanted to move along the curve by the specified lengthes?
DivideMultipleLength.gh (10.8 KB)
Thanks a lot Antoine, I will look into this. And also see if I can get it to follow my ruleset. I was not really looking for a complete solution, since I really want to learn something here. But I guess its good to look at others scripts too, especially if you’re stuck like I am at the moment.
Maybe I should just explain what I’m trying to achieve as a whole.
I have some standard noise barrier elements that im placing along a curve - could be road geometry offset curve - the elements are composed of 3m and 5m segments, but if there is crossing pipes/wires in the ground I need to have 1m tolerance between my columns and the pipe (edge to edge). The noise barrier will always start out with a section1 composed as 3x3m segments (fixed rule) and then continues with a larger section2 composed of mainly 5m segments - until it hits a pipe/wire tolerance issue, then it should take a step backwards and insert a 3m segment and then continue with 5m segments. In the end I will have to figure something out too, since the curve will of course not fit with the 3 and 5m division and the last section3 will be 9m and should also be composed of 3x3m segments, just as the beginning. The overall length is not completely fixed (can be ±1 to 2m, I guess), since it is the configuration of modules that determines the total noise barrier length, but I would like to take that tolerance in the middle section where it should either subtract a 5m segment and replace with a 3m if it becomes too long, or just remove the last segment in section2.
The output is basically just insertion points and a polyline that follow the ruleset.
If it doesnt make sense I apologize. I have also added my “static” script, maybe that makes sense, eventhough its pretty messy and WIP. Again I want to note that I am trying to learn as much as possible so I’m not necessarily looking for a full solution, but pointers to material or similar solutions would be nice, thanks a bunch for the help so far
NB Alignment sub division - GH forum.gh
I have refined my script using inspiration from Antoines Anemone script. I have tried to write the loops in Python components, and have succeded in getting it to work. But I get a runtime warning on the reparameterizing of my curve, the script works, but I get the error that it might be unprecise. Could someone who is more knowledgable please take a look? I tried looking into reparameterizing my curve in the loop, from some old posts, but that resulted in change in the segment length subdivision.
I am very new to python, and this is my most advanced script so far. I have tried to explain all steps and inputs, so hopefully it makes sense.
NB Alignment sub division - GH forum - solver_v3 excl tekla.gh (36.8 KB)
I will make a new post, since my original issue is solved.