Creating planes using C# component in grasshopper

Hi,

I am trying to create planes along a sine curve using the C# component, but some of the planes are not oriented as the others. I am new to coding . the .gh filesinewaveloft.gh (5.7 KB)

Curves are one-dimensional objects, they have no sense of orientation (it should in my opinion, although it is a heuristic and not explicitly mathematical). You have two options, either create the planes from the rhino methods and align them later (rotating, fliping or whatever), or create the planes on your own using the position and the tangent (the other vectors of the planes you calculate as you want them to be aligned), for example your case one axis could be the tangent and the other the Y axis of the world.

I created the plane with points and tangents ina forloop, but the orientation of some planes are different.

The methods you used to create planes were with “freedom”, not totally defined.
Origin+NormalVector doesn’t define only 1 plane, but infinite.

To create a specific plane please use this overload:
Plane pln = new Rhino.Geometry.Plane(Origin, VectX, VectY);

As your curve is on XZ plane, use vector Y “Rhino.Geometry.Vector3d.YAxis” with your tangent vector as the two vector inputs of the function.

1 Like

See attached: is an entry level C# exercise for controlling planes (for placing profiles and then do things). Includes another challenge as well (play with the rail options and spot the odd handrail Brep).

Curve_PerpFrames_EntryLevel_Demo_V1A.gh (129.6 KB)

1 Like

Hi @PeterFotiadis , please help me. I want to extrude profile with a rail, result is not good for me. Can you help me. I want profile perpendicular with rail.
One more , i have two( 3 ) profile , i need start profile one, middle profile two, the end is profile three.
Thanks for help me.

OK I’ll do an entry level demo (with C#) later on - after rhe Montegi MotoGP Q1/2 sessions.

That said ALWAYS put your profile(s) at Plane.WorldXY (that’s Plane from) in order to easily apply a PlaneToPlane Transformation (Planes To - “along” the rail)

On the other hand (general case : using any nurbs rail [planar or not]) you’ll need several planes To (controlled by some user resolution value).

This means that a gradual scale policy is required for the “not at start/end” planes Trans: i.e. for the “prev/next” positions to the “middle” one (for gradual values the norm is: a Cos/Sin based one - etc etc).

MotoGP race:

Good news: the wrong Ducati won.
Bad news: the right Ducati crashed (porca miseria) with 2 laps remaining .

Anyway … get an indicative take on that matter (using 2 profiles: some at ends, some at middle). No extensive (a must) profile Topology check is included (that’s a bit complex - and is unlikely that I’ll post something about it) for some sort of rational Sweep. No Jack for all trades solution: is suitable for ramps and the likes.

For LOL results play with the angle value.

Curve_PerpFrames_Combine2Profiles_Demo_V1.gh (135.5 KB)

Note: My moral (due to bad news) is rather low … thus I haven’t implement the general case (any collection “of proper/compatible” profiles). When this may happen? Well … some day.

Thank @PeterFotiadis for help me .

I fact … I found (forgot that one - done long time ago) what you want … but is using various internal (*) tricks and bits,

Given these (profiles MUST be checked for Topology combatibility in order to avoid bananas/twisted/etc sweep result):

Do that:

(*) but I can give you some hints:

  1. Add a handy addReversedHalf capability: say that you have 2 profiles. This makes 3 with the last : the middle one (or if you have N makes N + (N-1)).
  2. Add some Circular Shift option as well.
  3. For the “interpolated” (i.e. tween) Curves (per profile pair and using some resolution value(N)) do something like this: