DesignCAD 3D Max 2027 box
Now available

DesignCAD 2027

Hatches that follow their boundaries, an on-screen dial to turn your model, and a way to find any command by name, in a clean Windows 11 look.

point on a line given distance

Started by js, May 09, 2016, 08:19:35 AM

Previous topic - Next topic

0 Members and 0 Guests are viewing this topic.

js

I know it's a simple question.

I want to set a point on a line a given distance from the end of the line.

Now, I draw a vector with distance constrained ("j","d") and snap ("k") to the line and then draw the pointmark.

There must be a better way.
js

Dr PR

js,

Do you want to just place a pointmark or do you actually want to add another point to the line?

Are you using the "Point/Point Relative" function (' key)? This allows you to move the cursor and set a point at a given distance from some other point. For example, you can set a point (to start a new line or a pointmark) a given distance from the end of an existing line.

"Point Relative" gives you several options:

Last cursor position
From the drawing origin (X=0, Y=0, Z=0)
From a reference point
From the last point that you placed

The reference point option is the safest. You start the function, enter the X, Y and Z offsets (Z for 3D drawings only) and then press the "OK" button. The dialog closes and then you move the cursor to the desired reference position and left click or gravity snap to set the reference point. The program then sets a new point at the specified offset from the reference point.

To set a new point at X,Y distance from the end of an existing line you would start "Point Relative", enter the X and Y values, select the "Reference Point" option and press "OK."

Then gravity snap to the end of the existing line and the new point will appear at X,Y distance from the end of the line.

Phil
DesignCAD user since 1987

samdavo

WOW js, that is a great method.  Clearly I don't use "j" enough :)  Thanks

PS minor comment/ bit of pedantry, but you obviously set an initial point at the end of the line first;
and then, to get the direction, you can either click "k" near the line, or right-click snap to the other end of the line (2 cents). 

Rob S

I think I do have a better way, assuming quicker is better.   The tickmark command itself has the option for drawing them at a set (repeating) distance from the end of the line.

Start the tickmark command, click "change" until the first parameter reads "mark distance", then enter the desired distance, and click on the end of the line to start marking from.

Done.
User since forever

samdavo

#4
Clearly I don't use tickmark enough either lol.  Good one.

PS And tickmarks also work for compound lines made up of lines, arcs, curves, etc. (2 cents)   Great for drawing voodoo dolls :)

PPS Personally I have always used adriank's method (next post).

Adrian 2.0

For me, I'd draw a circle of the required radius with it's centre on the end of the line, then snap to the intersection of the line & circle.
(then delete the circle of course)
That's the great thing about DCad - so many ways to do things...

Dr PR

For those Like me that have never used "j/d" and have no clue what the "j" and "d" commands do:

J - "Point/Point Control" opens a menu of functions to set a point relative to a previously set point.

WITHIN THIS MENU ONLY:

D - Opens a "Custom Distance" dialog where you can specify the distance from the previously set point.

OUTSIDE THE POINT CONTROL MENU "D" STARTS THE "SECTION TRIM" FUNCTION.

For example, suppose you have an existing line at an unknown angle and want to set a point some distance from one end of the line.

1. Start the "Draw/Lines/Line" (V) function, set a point at the end of the existing line.

2. Type "J" to open the "Point Control" menu.

3. Type "D" to open the "Custom Distance" dialog and enter the distance N. Click "OK."

4. Now you will have a rubberband from the first point to the moving cursor at a fixed distance from the first point. Gravity snap to the other end of the original line to set a point the distance N from the first point.

5. Move the cursor and set a third point to finish the new line. The middle point on the new multisegment line will be at the desired distance from the first point.

****

I normally use Adrian's method of drawing a circle and finding the intersection. This is the classic geometrical method that has been used since Euclid's time. Unfortunately, this doesn't always work in DesignCAD. In crowded drawings the program sometimes fails to find an intersection between a line and a circle, especially in a 3D drawing.

The "Point Control/Custom Distance" trick works with straight lines, but doesn't work to set a point a defined distance along a curve.

Rob's "Tickmark" method will set a tickmark a defined distance along a line, curve, arc, circle, etc.

****

All three methods have the unfortunate side effect of leaving behind construction garbage. The circle method generates an unwanted circle and the tickmark method places an unwanted tickmark.

js' "Point Control/Custom Distance" method produces an unnecessary line segment between the first and second points.

****

OUESTION:

Does anyone know how to use the "Point Control/Distance" method without first setting the initial point? That would be really useful!

In other words, can "Point Control/Custom Distance" be used to set the first point of the "Line" or "Circle" functions from a reference point?

Phil
DesignCAD user since 1987

Lar

#7
***Try this: use 'angle and distance between points' and copy n' paste the angle into the Point Polar dialog box (Dimension menu> Info...,  I use U key for this and alt+U for the regular Units command). You can experiment with the angular precision but it seems that Point Polar will round it off to 2 places anyway. Of course, you will enter the needed distance in the point polar's distance field.***

Quote from: Dr PR on May 10, 2016, 12:08:47 AM
In other words, can "Point Control/Custom Distance" be used to set the first point of the "Line" or "Circle" functions from a reference point?
Phil, if I understand your question correctly you can set a free point (using relative or whatever) then use "Fixed Distance (#)" in the J-menu (shortcut J/F). <<<"J-menu" is my name for it, official name is "Point Control..." (last item under the "Point" menu)>>>

To change the value in the bracket you would have to use "Custom Distance" (J/D) first. This can be done before or after setting the first point. Ie, <<WARNING: the following description is way, WAY more complicated to write than to perform>>>, [a] if you know the fixed distance value is not what you want then, before setting the first point, use "custom distance" to change the value, then set the first point where ever you want. A ghost of the fixed distance will appear, waiting for you to set the 2nd point. [ b] However, if you set a point then press J but notice the value in the "fixed distance" bracket is not what you want, you would go to "custom distance", input the new value then set the 2nd point for the fixed distance.

Once you get familiar with the process it can be performed very quickly.

Lar

Dr PR

Lar,

Thanks. I followed what you said, using "J/D" (Custom Distance) to set a distance first.

Then I started the "Line" (V) function and used "J/F" (Fixed Distance). However, this only works IF I have already set the first point of the line. Then the result is a new (unwanted) line segment between the first point and the point set with "J/F."

If I haven't already set a first point, after using "J/F" or "J/D" when I set the first point for the line point control doesn't work. It just works like the normal "Line" function if I don't bother with the "J" "Point Control" options.

****

This discussion is the first time I have ever heard of the "Point Control" menu and the functions in it - since I started using the program in 1987 - and I am trying to figure out why anyone bothers with it.

What I would like to see is for the "J/D" and "J/F" functions to work as follows:

1. Start the "line" (Circle, Arc, whatever) function by pressing "V" but don't set the first point yet.

2. Use "J/D" to set the desired distance relative to a reference point (which hasn't been set yet).

3. Set a point to serve as the reference for the custom distance but not as a point for the line. Then the program would generate the rubberband line with the fixed length from the reference point to the cursor just as it does now.

4. Click or gravity snap somewhere to set the first point for the line/circle/arc at the desired distance from the reference point and then continue drawing the line as usual (perhaps using "J/D" to set additional points relative to places in the drawing).

****

This would allow us to start a line/circle/arc somewhere relative to a reference point without having to draw extra construction lines or set the angle (as in "Point Polar") or XYZ coordinates (as with "Point Relative").

This would be especially useful for starting a new line/circle/arc on an existing line/plane edge/solid edge some distance from an existing point on the line/plane/solid.

Phil
DesignCAD user since 1987

Lar

Quote from: Lar on May 10, 2016, 07:31:14 AM
Phil, if I understand your question correctly
Well, Phil, I guess I misunderstood didn't fully read your question. I should have paid more attention to the last four words (also, thanks for the J/D hint. I had J/C).

To now answer your question: go about drawing a fixed distance line as you described, except when snapping to the 2nd point to the end of the existing line carefully press the period key instead of the mouse, so that the mouse or table doesn't jerk. This 2nd point would place the cross-hair at the fixed distance on the existing line. Now carefully press the Esc key twice (to get rid of the first 2 points of the fixed distance) then K (to snap a new starting point to the existing line). Now go about finishing the line.

To answer this topic's starting question (by js): select the line you want to add a point to then follow the method above to draw a fixed line, except you can gravity snap with the mouse to set the 2nd point... then use the keyboard to carefully set a 3rd point right on top of the 2nd point. Now carefully press the Esc key 4 times (to get rid of the 3 points and abort the line command), then press K twice (to set the new point int he line. All this must be done without the cursor moving of the point won't be exactly at the fixed distance. The purpose of the 3rd point was to place the "no-command" mouse at the fixed distance (if you set 2 points and press Esc 3 times the cursor would jump back to the end of the selected line where you last clicked).

***

Quote from: Dr PR on May 10, 2016, 09:11:05 AM
This discussion is the first time I have ever heard of the "Point Control" menu and the functions in it - since I started using the program in 1987 - and I am trying to figure out why anyone bothers with it.
Phil, I find the Point Control menu extremely useful. I hardly use fixed distance (though I probably will now use it more for the purposes I described above) but I use both 'same angle as...' and both 'angle away from...' commands quite often. 'Custom angel' can also be very useful. 'Previous Angle' seems useless, since it only repeats the angle of the last segment in the same line command and isn't available for the start of a new line.

Lar

Dr PR

Lar,


When I read js' original post I had a gut feeling that it wouldn't work correctly. See the attached drawing.

With the J/D operation the cursor position orbits around the first point on a circular path (blue). When the "Line Snap" (K) function is used it sets a point along a line from the cursor position perpendicular (red) to the original line (black).

There is only one position on the circular path (blue) where the "Line Snap" function will set a point on the line at the exact desired distance along the line - the point where the circular path intersects the line. This perpendicular (green) is tangent to the circle at the point of intersection with the line (black). From any other position on the circle the "Line Snap" perpendicular (red) will intersect the line at a distance shorter than the radius of the circle (the desired distance).

Therefore, for all practical purposes the "J/D K" function combination cannot set a point at the desired distance from the end of the line.

****

Your concern about not accidentally causing the cursor to move while setting/clearing all those points is valid. Sometimes just typing on the keyboard creates enough vibration to cause the mouse/trackball to change position slightly. For this reason I would be leery of using ESCape to backtrack and remove points. There is nothing to ensure that the cursor doesn't move before you use "Line Snap."

Phil
DesignCAD user since 1987

Lar

#11
Quote from: Dr PR on May 10, 2016, 08:23:30 PM
... When the "Line Snap" (K) function is used it sets a point along a line from the cursor position perpendicular (red) to the original line (black).
Phil, using line snap should be no cause for concern here (as long as the cursor is not constrained, which it shouldn't be anyway). With fixed/custom distance the distance of the cursor from the 1st point is not important, just the angle. So, once you gravity snap the 1st point at one end of a segment of a line, you can snap the 2nd point anywhere else along that same segment. Using line snap, mid point snap, gravity snapping at the other end or intersecting with another crossing line would all work out ok. The only time for concern with line snapping is if you are drawing a line segment at some constrained angle and you want to hit another line of a different angle that is not perpendicular to the first line. In this case you would have to line snap at the exact intersection point for the two lines to connect.

Personally, using js' original fixed distance method or adrian's circle method and then deleting the junk entity afterwards is not a big deal for me. Or use 'angle and distance between points' and copy n' paste the angle into the Point Polar dialog box (Dimension menu> Info...,  I use U key for this and alt+U for the regular Units command). <<<in fact, this may be the answer js was looking for. I will add it to my first post for future searches>>>.

Quote from: Dr PR on May 10, 2016, 08:23:30 PM
Your concern about not accidentally causing the cursor to move while setting/clearing all those points is valid. ... ... ...
For me this is not a big concern. I trust myself in not causing the mouse to twitch and I can easily use the original Units command to check. I just mentioned this for new users.

Lar

Dr PR

Lar,

You are right about the "J/D K" operation. "Line Snap" may snap a perpendicular to the line to select a point on the line, but the "Custom Distance" seems to override it and cause a point to be set at the correct distance.

Thanks.

Phil
DesignCAD user since 1987

bdeck

#13
Quote from: adriank on May 09, 2016, 04:49:31 PM
For me, I'd draw a circle of the required radius with it's centre on the end of the line, then snap to the intersection of the line & circle.
(then delete the circle of course)

I've used this method for so long, I cant see any reason to look for another method.

Dr PR,  What cad software do you suppose that Euclid fellow used?

bd

Bob P

This macro will create a construction line in the same direction and with a given length along another line. I use it to temporarily find a point along an existing line.

' Program: ldist.d3m
' this program draws a line with a specific distance and direction.

' based on cartesian vector algebra
' point 1 defines the starting point of the line
' point 2 defines the unit direction vector (line direction)
' a positive length draws line from point 1 in direction of point 2
' a negative length draws line in opposite direction

' created for dc version 13

precision 15

npts = sys(1)

if npts <> 2 then
sys(1)=0
setpoint "set line points: 1) starting position, 2) direction ", 2
end if

pointval cx cy cz 1
pointval ex2 ey2 ez2 2

sys(1)=0
dx = ex2 - cx
dy = ey2 - cy
dz = ez2 - cz
d = dx * dx + dy * dy + dz * dz

if d = 0 then
message "error: 1st and 2nd points are identical, unable to determine unit direction vector."
end
end if

d = sqrt(d)

'unit vector
di=dx/d
dj=dy/d
dk=dz/d

input "enter magnitude (length) of the line: ", rz$
r=val(rz$)

if r = 0 then
message "error: no line length input provided."
end
end if

'direction vector components
rx = r*di
ry = r*dj
rz = r*dk

x2 = cx + rx
y2 = cy + ry
z2 = cz + rz

>line
{
<pointxyz [cx, cy, cz]
<pointxyz [x2, y2, z2]
}

>redraw
{
}
end