Transformations for cross-section geometry

I am defining cross-sectional geometry in the XY plane and I want to apply it to lines in Rhino (to the start point) and sweep it so it “fleshes” a beam for example. The beam’s local axes are calculated specifically and I want to remap the cross-sectional geometry from the XY plane to the coordinate system of the beam.
image

I have tried with Transform.ChangeBasis and also with Transform.PlaneToPlane but I am not getting it to work properly with either.

When using Transform.PlaneToPlane, since the plane only has a normal and no “X” or “Y” axes, I assume it is not the tool for this case since I do have specific axes as shown in the graphic above. In the image below for example, seemingly for no reason, the two beams are rotated differently.

So that leaves me with Transform.ChangeBasis, which does not work consistently for all of the beam directions I am testing. Any pointers for how to use it in this scenario?

A plane most definitely has an X and Y axis: Plane.XAxis Property , Plane.YAxis Property

Transform.ChangeBasis is not what you want.

– Dale

Indeed, after using Transform.PlaneToPlane with the overload that accepts the definition of a x and y axis it works.