Is there an 'align planes' option for FrameAt method?

Hi Everyone,

I am using the FrameAt(double t) method to get frames along curves

Code as follow:
image

This is the result I get:

You can see that frames werent aligned automatically.

There is a grasshopper component allows this option, anyone knows how can I do this in C#?
image

Thank you!

Since you already seem to be scripting, you could go through all planes starting at the second one, measure the angle between the y-axis of the previous plane and current one. If the angle is bigger than for instance PI/2, flip the plane. If I’m not mistaken, you’ll end up with somewhat homogenized planes.

Oh That sounds brilliant :bulb:! Thank you!

However, im not sure if there were something wrong with my code, there is no error message, but doesnt seem to be rotating the planes. Mind shedding some light on this?

Thank you!

You need to compare each plane to the previous plane! 0 is also too tight of a tolerance. I’ rather give it some more leeway, judging by your screenshot maybe Pi / 2 or a little less.

I don’t really know C#, but I guess it would look something like this:

for (int i = 1; i < plnList.Capacity; i++) {
  if (Vector3d.VectorAngle(plnList[i].YAxis, plnList[i-1].YAxis) > Math.PI / 2)  // maybe Pi / 4?
    plnList[i].Rotate(Math.PI, plnList[i].Normal);
}

I’m more of a Python and C++ aficionado. :wink:

If you have ramps and the likes in mind (meaning your rails are “reasonable”) OR some other thing where a Vector3d could explicitly define what is “up” … then I would strongy suggest to use this way (equally fast with PlanB: i.e. asking various DotProduct related questions):

This is used in AEC oriented stuff like these (you can rotate the planes Math.PI/2.0):


BTW: green lines (profile planes XAxis) help to prove the whole point.