algorithmic modeling for Rhino
Hi guys
I just joined the community and have been working to learn Grasshopper for a month now. I'm trying to create a small algorithm, that will:
1) Take a bunch of lines
2) Figure out their intersections
3) Split the lines at each intersection to create smaller line segments
4a) Identify the line segments that are ending nowhere and delete them - OR:
4b) Identify the line segments that are ending at an intersection point at both ends and keep it - delete all other line segments.
So far I've found the intersections and segmented the lines, but I can't figure the logic to delete the correct lines.
I have attached a screenshot.
What I want is to keep the 3 lines, that create a triangle between them, but delete all the others, which ends nowhere, so I end up with only the 3 line segments that defines the triangle, so it can be joined.
Can you help me?
Tags:
Hi Christian,
This is what I would do:
1. Get the endpoints of your new line segments
2. Test them against the Set of Intersect Points
3. Any where there are 2 matches keep
Components In screen shot: Shatter, Explode(Curve), Create Set, Member Index, Shift Paths, List Length, Larger Than, Cull Pattern
Hi Danny
Thanks a lot for the quick answer - this solves my current issue completely. Awesome!!
Now I need to work on it, to make it work on a larger scale (with more lines and more internal triangles/squares, etc.) - but this takes me a mile closer to my overall solution.
Thanks again!
Kind regards,
Christian
Oh this was a fun one. Almost gave up too.
I used somewhat different logic to shatter all line segments, I couldn't quite work out how your components were supposed to work.
To cull all unwanted line segments, the idea is to:
Writing this now, it would probably have made more sense to measure distances and add them together. If both distances are zero then the sum will be zero. But I went the box->text way instead.
--
David Rutten
david@mcneel.com
Here is my try using ShatterInt and Anemone.
You guys are really awesome!
I was able to finish my algorithm to work with all the lines and curves that I throw into it, and now I'm creating some very interesting designs.
Thanks for your quick help and ideas!
PS. Special thanks to David and Systemig for sharing your ideas, even after Danny already answered. I learned a lot from looking at your 3 different approaches.
Kind regards,
Christian
I attached the file, you can just open that instead of deciphering the picture.
I don't think the mobile webpage has options for attaching images/files/links. It's just a plain text field...
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by