Mesh Normals as Vector for Z-axis of a Cylinder (on Mesh)

Hi,
it’s maybe easy, but I can’t get my head around…I hope someone here knows what to do.

Goal: I want to us the mesh normals on a specific point on the mesh as a vector that directs the z-axis of a cylinder (or any other geometry).

Problem: I get the cylinders on the points but the Z-axis points just in world-z-Axis. I want each cylinder to point in the direction of the mesh face normal at the specific posiition.

What I did:
The point is on the mesh. So I use the MeshClosestPoint. I use the points (P) output as origin (O) input for the ConstructPlane that defines the baseplane for the cylinder.

I extract the normals with FaceNormals from the mesh and feed it to a ListItem. The ListItem gets its index from the MeshClosestPoint.

From the ListItem I use UnitVecotor to unitize all normals. The output I feed into a DeconstructVector to have values for XY&Z.

To get the right format as vector I use VectorXYZ and feed it in a ListItem for each axis. This data I feed into the ConstructPlane.

mesh normals as vector for z-axis of cylinder on mesh.gh (109.1 KB)

Thank you! : )