Create a tangential (lofted) surface between two non-coplanar cylinders

Hello!

I am new to the forum and need some help with a project I am stuck with. I am creating a tool for planning the guidance of 35mm film via deflection pulleys. For this I input a poly line, extract the points (as deflection pulleys) and calculate the cross product of the vectors to get the angle of the pulleys. I want to visualize the torsion of the 35mm film and for this I need to now the tangential point on the pulley cylinders to create a 35mm line which is then lofted with the previous one to create the film.

But I do not know how this can be (geometrically) calculated. My first approach was to make a helper circle which is coplanar to the previous one to create a tangent, and then rotate it back to it’s proper position in space but I did not manage to match the radial rotation of the circles.

Is there an “easier” or better way? Another issue I cannot wrap my head around is how to automatically chose the right “side” of the cylinder so the film wraps around the cylinder and not below.

Would really appreciate some tips and / or hints!

Thanks!

tool_2.gh (14.8 KB)
tool.3dm (2.6 MB)

What’s the correct order in which these things need to connect?

They should be connected in the order of the poly line (from which the control points are extracted). In the current .gh file the last control point connects again to the first one and it results in a close loop (which is not crucial but actually a preferred behavior for the tool).