Hi! I’m new to Rhinoceros and I’m looking to solve my dilemma. What I have are coordinates of sphere centers imported from CSV. These spheres are arranged randomly though discrete element modeling. I need to connect the spheres with cylinders at the tangent points but first, I need to know how to determine their location. Is it possible using python?

If two spheres are the same diameter, then the line segment between the sphere centers will be the center line of a cylinder of the same diameter of the spheres, and the cylinder will be tangent to both spheres.

Simple example using the Sphere, Line, and Cylinder commands (not Python): Sphere Cylinder 01.3dm (1002.3 KB)

If the spheres are not the same size then you have to make a small adjustment to make it tangent to both spheres. You don’t need this but it might be helpful to someone else who arrives on this page looking to solve that problem.

This code might be primitive to experts here. But just in case someone needs it or someone would like to correct my code, please feel free to do so and I would appreciate it! Code1.py (1.5 KB)