Incrementally shatter segments of same length on different given curves

Good afternoon ! I am a landscape architecture student new on grasshopper and stucked on the following task :

  1. I have a few contours in the same plane.
  2. I want to shatter each contour by 2 points, A and B
  3. Point A on contour 1 is at distance n from point B on contour 1
  4. Point A’ on contour 2 is the perpendicular projection of point B on contour 1
  5. Point B’ on contour 2 is at distance n from point A’ on contour 2

… And so on till all contours are shattered.

This task is part of a larger script to draw lines of a constant slope on a 2D topography. (2D because in 3D the script I did was too expensive in computing time for big topographies.) The script already works well from contour to contour, but since the topography is huge, I can’t do the operation manually between each contour… I think this pre-task would help a lot to make the drawing of theese lines quicker !

If someone has any tips to help, I would really appreciate it !
Thanks a lot for reading.

Here attached my trial script and given contour file as well as a scheme for better understanding of what I am trying to do.


Given contours.3dm (109.7 KB)
Progressively shattered segments on contours with perpendicular relationship.gh (20.9 KB)

This is the detail of part of the script from contour to contour that already works well for info :
The perpendicularity constrain serves to join well each constrant slope curve.

Progressively shattered segments on contours with perpendicular relationship.gh (39.8 KB)

1 Like

if you want a way to do that without code, this might work (requires Anemone plugin for looping), and relies on the fact that the starting curves are sorted the right way

Progressively shattered segments on contours with perpendicular relationship_inno.gh (40.9 KB)

a Loop is the best way to do that, because now you have like 6 curves so you might thing of concatenating components 6 times… but if you find yourself using this on like 600 curves, then you can’t concatenate components 600 times :slight_smile:


if I may, one note @dn.aur your solution is beautiful but I think it finds connection points perpendicular to the target curve instead of the sender curve:

1 Like

Hi Dan !
Thank you very much for your anwer.
I definitly need to learn to code, looks to be a great tool !

I had a try on a more complex topography. It works, well but the distances of the segments are variable. I wonder if it is because the script calculates the length of the line from it’s begining, and since they are doing a lot of curves, start and end points of the segments get shifted.

Here some images of the trial :

General view:

Zommed in:

Thanks a lot again !

Hi Inno !

Thank you very much for your reply and script idea. Anemone is very helpfull, I didn’t knew this plugin !

Here a photo of the result I got using Anemone. The yellow lines are what I was stuck on before this post.


Indeed doing it by hand would have been painfull…

Thanks again to both of you !

1 Like