This version doesn’t require the line to already exist. You need to pick two points that define the line. The point(s) (or any objects) that will be pulled to the line need to be pre-selected.
Make a line and a point somewhere next to the line and then select the point and run the macro posted above (or follow David’s steps). For the macro, you will need to click on two different places on the line and the point will be moved to the closest point on the line. The idea is you create a cplane perpendicular to a line that goes through the cplane origin, then use setpt to make the point snap to the closest point on the line.
This also can be used to make anything linear. For instance, making control points linear in order to make curves or surfaces tangent.
Or you can use it to straighten a curve so that it is linear to any two points. Just select the curve and run the macro and click on two points and the curve will become straight and in line with the two points.
Damn, I must be the dumbest person in the Universe, but frankly I still can’t understand what must be the orientation for the line. Could you post a screen-shot before/after with visible CPlane?
Just for kicks, below is a script that will PULL selected points and control points to an infinite line determined by clicking two points. Note this works different than SetPt, as that is actually a projection type function. The script uses the function ClosestPoint for each selected point or cp to determine the direction and distance to pull. Note that the target line is infinite, so depending on the geometry, the points will not necessarily fall between the two points you clicked.
This works on non-planar curves and points and in theory will also work with surface control points. Some of my experiments here with surface control points made Rhino go into a spin with creating meshes in shaded mode - but it eventually finished. The objects’ control points have to be active first, but they can either be pre- or post selected.
The orientation of the line can be any orientation you want it to be. Any two points that you want that are not the same define the line.
What is the difference between projecting and pulling a point to a an infinite line?
IMO, The advantage of using setpt as an alignment tool is that it works on anything that setpt does. So if you have a curve or line segment that was supposed to be linear but is off a little you can make it exact. Or possibly you may want to subselect and edit an edges of planar surface or mesh to make linear.
The read arrows show the points pulled to the line.
Note that the points in this example are not planar so in the 2D screen capture some of the arrows are not perpendicular to the line. In 3D the arrows are perpendicular to the line. See the attached file for more.