Drawing line between point and every vertex on a mesh. I need help


I am trying to produce a collection of lines radiating out from a central point to the surface of a sphere. I have no idea how to achieve this, but am working with the concept of connecting a point at the center of the sphere with the vertices of a mesh I made from the sphere surface. But I cannot do this manually…

Please see attached.


If the vertices of the mesh are at equal angle increments around the center of the sphere, then create 1 line from the center to a pole, use ArrayPolar with the line to create a fan of lines, and then use ArrayPolar with the fan of lines to create lines to each vertex. Use SelDup and Delete to delete the duplicate lines.

Brilliant, that is a great start. Thank you davidcockey

This is where scripting or Grasshopper can come in handy - here’s a python script that will do this:

import rhinoscriptsyntax as rs
import Rhino

def RadialMeshLines():
    id = rs.GetObject("Select a mesh.", 32, preselect=True)
    if not id: return
    mesh = rs.coercemesh(id)
    pt = rs.MeshVolumeCentroid(id)
    for v in mesh.Vertices:
        rs.AddLine(pt, v)

You can copy/and paste that into a session of EditPythonScript, for example and run it from there to get an idea how it works, or paste to a text editor and save it as a .py file and use RunPythonScript

Here’s a simple Grasshopper definition:

RadialMeshLines.gh (6.7 KB)

Does that help at all?


Thank you Pascal. Haven’t started using scripts yet. Will need to soon.