Pull points to a line

Update As pointed out by @Normand below Align with ToLine does this already.

Method to pull points to a line. (Does not work for a curve.)

Create a Cplane perpendicular to the curve: Cplane with Curve option

In the viewport with the Cplane perpendicular to the curve:
SetPt with Set X Set Y and Align to Cplane
image

Undo the Cplane: Cplane Undo

2 Likes

As an alternative to your method, you can use this macro:

_CPlane _3Point _pause _Z _pause
-setpt xset=yes yset=yes zset=no alignment=cplane copy=no 0
_CPlane _Undo

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.

4 Likes

I’m not sure that I understand what’s the goal. Maybe it’s my poor English. Could somebody upload a Rhino 7 3dm file, a picture or a video?

The original goal is to pull a point to a line.

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?

Count me in :upside_down_face: In my head it does the same as Align with the ToCurve or ToLine, but there’s probably something I’m missing.
-Jakob

2 Likes

I’m one of those persons that understands better with some clear visualization. :slight_smile:

Yes, it does the same as Align with ToLine. I was unawre of that option. Thanks for pointing it out.

I’ll edit the original post.

1 Like

Is using the project command not easier ? Create a temp surface ?

Example:


PointsToLineDC01.3dm (2.1 MB)

That is completely different.

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.

Maybe useful… or not.

PullPointsToLine.py (1.9 KB)

2 Likes

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.

For some reason I still can’t understand this. A simple visualization would help a lot.

Something other than this?

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.

If i want to pull the control points or points
to a bend curve,


then?

Align with the ToCurve option,