Grasshopper

algorithmic modeling for Rhino

Hi & thx in advance.  

I have a seemingly simple question about organizing points in a Curve | Line intersection.  I have some complex curves that are being intersected by lines X times, this will always result in an odd number of intersections and I should be able to call the events in order.  

My question is:  How do I sort these to draw new lines from pt(0) to pt(1) then from pt(2) to pt(3) until the end of the intersection array ( (X-1) to (X) ) for each of the sets of intersections?  I'm very familiar with Rhinoscript and know how this would work in that interface but I'm struggling to find the functions in GHopper.  

Thx All!

DH

Views: 1945

Attachments:

Replies to This Discussion

 Try to build ConvexHull(Mesh tab) around intersection points and then sort your points with SortAlongCurve tool(Vector tab, curve to sort along - convex hull polyline) and create polyline from this points.....

Surely you mean even, not odd? The points returned by Line|Curve intersection are ordered along the curve, not the line. This seems like a stupid thing to do, I never noticed it before and I can't now remember whether there was a reason not to order them along the line.

At any rate, they have to be re-ordered. The easiest way to create line segments between points 1&2, 3&4, 5&6 etc. is to create polylines, explode them, then cull every other segment.

--

David Rutten

david@mcneel.com

Attachments:

Many thx!  I did figure this out after taking the one to hour break from scripting required to see where I'd screwed up.  Reorienting my understanding of the logic a bit to get the tools working as well as I can in Rhinoscript.  Not quite as elegant as yours.  Thx again!

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service