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.

Moving a point in a certain direction

Started by Bob P, May 22, 2012, 06:10:57 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Bob P

A small change to a current command or an entirely new one...

Problem:  I want to move an entity's point (*) a certain distance, in the direction of a line.  If I could enter a negative number in the Point Options > Custom distance I could snap to the original line to define the (opposite) direction.

Alternately, add a new Point Option that included both a distance and direction.

I can do a macro, but it seems to me that this should be a native option.

Or am I missing something?

Lar

Hope I'm on track here...

Custom distance works for me, but only if the line is aligned to the x, y or z axis, or I have something to snap to that's already at the angle of the line. This could be the same line if the point in question is not an endpoint that I want to make longer.

To make a line shorter I would start the * command, snap on the endpoint to be changed, press J for the point control menu, click 'fixed distance' (if the value is there) or 'custom distance' (if the value has to be changed), then move the mouse back along the line and 'line snap'.

This also works for internal points since you would have 2 segments to snap to (but only if shorter along either of those segments).

To move beyond the point in the same direction (of a non x,y or z direction) just click anywhere on the line inside of the point, to select the line... put the mouse over the big blue handle and hit N for duplicate... snap the duplicate onto the endpoint to be moved... then you will have a line at the correct angle to snap to when using custom distance. Delete the new line when done.

FYI:
1] To make a 2-point line shorter or longer by a certain distance use the 'length' field in the info box by either subtracting or adding the distance to the existing length.

2] For non-ortho directions you can use the snap grid with the 'isometric' option.

Lar

Bob P

Lar,

That would work for a line, but I mostly use this to extend/expand the vertex of a non-orthogonal plane in 3D space.

Lar

I can't get 'custom distance' to behave properly in 3d anyway. You can change the value but the 'fixed distance' part of the command doesn't really work for me.

Lar

MarkX

I guess you would need a "same direction as line" and then you select the line (similar to rotation). Otherwise, in 3D, specifying a direction would be non-trivial.

A feature I find useful enough to map a key to (Shift-W) is the ability to set your own work plane. Just set a temporary workplane to match the plane you want to alter. Then in point-mode pick up the vertex you want and move with Point Polar.

Mark

prl

Quote from: Bob P on May 22, 2012, 06:10:57 AM
. . . I could snap to the original line to define the (opposite) direction.

I'm surprised you can't input a negative distance.  A negative distance does mean the other direction (180 degrees).  I have a v2 program that employs this math convention (vector algebra).  Set the first point on a corner, snap the second point on the edge of something, enter a negative distance, and it draws a line from the first point for the distance specified in the opposite direction of the line or edge snap.  Very handy with pointselect mode moving entire edges of solids.

prl

#6
Quote from: MarkX on May 22, 2012, 09:07:33 AM
A feature I find useful enough to map a key to (Shift-W) is the ability to set your own work plane.

Pretty good feature though not rock solid.  Never save and exit your drawing in a temporary work plane.  Always make sure you are in the default xyz. There's a bug somewhere in the code that I'm sure hasn't been resolved.

Edit: ;)


DrollTroll

prl, the problem of saving with an active workplane was solved in 21.2.
25 years with DesignCAD

Bob P

#8
Here's the macro that moves an entity's point in a given direction:
*Added more annotations in the code

''vpm.d3m
' Move a point a given distance along a line
' Note that if you enter a positive distance value, the point
' will move _toward_ the second point.  Use a negative number
' to move the point away from the second point.

' point 1 is the point to be moved.
' point 2 defines the direction (along with pt 1) that the point will be moved.
' 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 14 and up

precision 15

setpoint "set line points: 1) point to be moved, 2) direction ", 2
Input "How far from first point?" dist

pointval x1 y1 z1 1
pointval x2 y2 z2 2

sys(1)=0
dx = x2 - x1  'dx, dy, and dz are the direction vectors of the move
dy = y2 - y1
dz = z2 - z1
d = sqrt(dx^2 + dy^2 + dz^2)  'd=the numerical length of the move

if d = 0 then 'Check that the points aren't coincident (set on top of each other).
message "error: 1st and 2nd points are identical, unable to determine unit direction vector."
end
end if

'The original positions plus the unit vector dx, dy, and dz distances
di=x1+((dx/d)*dist)
dj=y1+((dy/d)*dist)
dk=z1+((dz/d)*dist)

>pointmove
{
<pointxyz [x1, y1, z1]  'original point
<pointxyz [di, dj, dk]  'new location
}

end

prl

Quote from: Bob P on May 24, 2012, 09:02:04 AM
Here's the macro that moves an entities point in a given direction:

Thanks Bob, good use and nice to see someone keeps notes.   :)

Pearco

Bob;

Those commented lines sure help us amateur programmers a lot.  Thanks
Jim
User since ProDesign 1.5

Dr PR

DT,

I'm using V22.0, and apparently I saved a drawing with a temporary workplane in effect. When I opened it again the axes were totally screwed up.

Phil
DesignCAD user since 1987

Dr PR

Bob P,

Be very careful to ensure that the moved polygon point remains in the same plane as the rest of the polygon!

DesignCAD will allow you to move points out of the plane of the polygon, but then it will turn around and bite you in the posterior for having done so. Non-planar polygons can cause some very wierd shading problems, and they are extremely difficult to cure. I speak from experience!

Phil
DesignCAD user since 1987

Bob P

Quote from: Dr PR on November 20, 2012, 10:21:31 PM
Bob P,

Be very careful to ensure that the moved polygon point remains in the same plane as the rest of the polygon!
That's precisely why this macro is useful.  Theoretically, the new point will remain in the same plane.