Grasshopper

algorithmic modeling for Rhino

hi,

i'm having a problem with a loft in grasshopper

i'm using grasshopper-generated control curves. the list is in a correct order, but it seems the curves have varying directions (or at least i think that might be the reason why the loft is messed up).

it's weird though, because when i bake the control curves and loft them in rhino, the result looks fine without any adjustments to the curves or the loft.

 

i'm attaching screenshots and source files. please, let me know if you have any idea

 

thanks!

 

 

Views: 9585

Attachments:

Replies to This Discussion

Indeed, Rhino Loft automatically adjusts curve directions. you can use the Flip Curve component with a guide curve. If that doesn't work, I'm out of ideas.

 

--

David Rutten

david@mcneel.com

Poprad, Slovakia

thanks, david

i realized what the troubble is, however i don't know why the curves are flipped randomly in the first place. they all are creatied as an interseciton of a single brep and a set of parallel planes.

 

i'm working on a very difficult workaround now, but i'm sure it will be possible to simplify it eventually.

ok, i've got a solution. it's messy and i'm sure it's possible to make it more simple, but all my other attempts failed. note that my control curves are planar and parallel to the XY plane. the main idea is to distinguish the direction of the loft control curves - it's either clockwise or counterclockwise. therefore i found geometrical centers of the control curves and two consecutive points on the curves. then i draw lines from thecenter to thefirst curve point and from the first to the second curve point - let's call them L shapes. the shapes show the direction of the curve's rotation. then i aligned all the L shapes by their first segments and check whetherthe second segments point to the left or to the right. this makes a pattern for flipping the wrong control curves. 

 

the solution in steps, maybe might help someone in the future :

  1. find a geometrical center of each closed control curve: bounding box -> diagonal axis -> middle point of the axis
  2. evaluate each control curve at two consecutive points: -> eval at domain parameter 0 and 0.5
  3. draw a line from the center to the first point and from the first point to the second one (an L shape)
  4. move the L shapes to the 0,0,0 (probably not neccessary)
  5. rotate the L shapes so that the first segments align: measure the angle of the first segment and an X axis (use XY world plane, otherwise you won't measure angles above 180 degrees!). the shapes are now aligned but some are pointing to the left, others to the right. this distinguishes flipped loft control curves
  6. decompose the L shapes into three control points
  7. decompose the first and the last points of each L shape into their X Y Z components
  8. compare Y positions of the first and the last points ( larger or smaller math component)
  9. use the pattern to flip the wrong loft control curves
  10. that's it

my grasshopper definition is very untidy, so i won't attach it, but this is pretty much the idea.

 

Hi Jan, what I'd do is make planar surfaces from the contours and check their normal to find out what curves are flipped:
Attachments:
that's really simple. thanks!
You don't even have to create the planar srfs, if you know the curves are planar you can plug them directly into the Evaluate Surface component:)

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service