Lines from point to projected point

Hi, I’m trying to create code that would look at all the points in my 3d plane, identify their projected points (on the 2d x-y plane) and create a vertical line from the point to the projected point. any ideas?

Not sure if you are using python or rhinoscript but here is a python example. I used a point cloud for the points on 3d plane.

import Rhino
import rhinoscriptsyntax as rs
import scriptcontext as sc

# user select the point cloud
point_cloud_guid = rs.GetObject('select point cloud')

# get the point cloud geometry
point_cloud_geo = rs.coercegeometry(point_cloud_guid)

# loop through every point cloud item, use it's .Location to get to x, y.
for pci in point_cloud_geo:
    loc = pci.Location
    x = loc.X
    y = loc.Y
    projected_point = Rhino.Geometry.Point3d(x, y, 0.0)  # just drop Z for x-y plane
    line = Rhino.Geometry.Line(loc, projected_point)  # make the line
    sc.doc.Objects.AddLine(line)  # add line to the document.