Orient plane along a curve?

Hi. I need to create a Grasshopper definition to quickly create some handrail profiles and I managed to create one that it is working relatively well on straight and curved along Z curved rails but unfortunately I can’t get this to work when the rail it is rotating also along the X or Y planes.

I need to make a shape that connects the profiles 1 and 2 from the bellow picture.

In my definition the CPlanes axis are rotating into the wrong directions and I don’t know how to fix this.

Kind regards.

Handrail_curved_mantainZ_down.gh (24.0 KB)

Handrail_curved_mantainZ_down.3dm (866.0 KB)

Hi,

maybe you or someone else can use this to develop it further.
You should rethink whole process from the very beginning, IMO that is where the major issues are…

Handrail_curved_mantainZ_down_RE.gh (242.6 KB)

I don’t see how it’s possible to join those two sections of railing without a twist? And working so far from the origin is a pain and can cause problems.

I ignored most of your code and didn’t bother to try and generate a fair “rail curve” between the two center points, as it appeared you were trying to do? I just did a ReB (Curve Rebuild) to get a smoother curve, and Align planes with the ‘Y’ vector:

Handrail_curved_mantainZ_down_2019_Jun25a.gh (114.9 KB)

(oops, sorry, I grabbed the wrong code to start with…)

Thank you @Joseph_Oster for Rebuild Curve tip. It looks smoother now.

I agree, it is a pain-work and it is not giving the most satisfying result. There are 2 tasks to be solved properly:

  1. To generate a fair “rail curve”
  2. To rotate/twist profiles to match perfectly on 0 and -1 position.

I posted it in hope that someone else would find a better solution and i am curious how it would look like.

As mentioned in 1st post, maybe whole process should be rethinked from the very beggining and maybe this is not a GH-task at all. In other modelling tools this would go much easier for sure.

Handrail_curved_mantainZ_down_RE_2.gh (241.8 KB)

It is possible. Our joiners are doing this by hand every day!

I only need to find a way to do it properly also software-wise!

I think this twist can be achieved if one of the axis maintain orientation to centre of the Z axis (from top view the twist is half circle).

In this post it is described a similar problem.

In other modelling tools it is not working at all. For this reason I need to create a Grasshopper definition as seems much more easier to create a custom tool for this task. I only need to find the proper “algorithm”.

1 Like

This is my best take at it.

2019.06.26_mcneelforum_thecyclist.gh (19.0 KB)

1 Like

@TheCyclist: Thank you for the definition. Quite close, but still need more work. From the side view the final object don’t follows the shape of the initial curve. I will use your definition as a reference.

Very nice. How did you get the two rail curves?

I generated new curves from the rail geometry instead of using the magenta curve in your original 3dm file.

I just blended some curves between the two rail pieces. I didn’t use the magenta curve in the original file.