Moving object along an axis command?


I am looking for the command in a lisp that would move and another command to alternatively copy selected objects "ss1" along the say X- or Y-axis or Z-axis by inserted distance value "d1"....

What would I write for the above to include the selection set and distance value...?



Reply to
David Penney
Loading thread data ...

If you are using a (COMMAND ....) the from point and the to point is the place to focus. (All zeros for base point, zeros for the two you want to remain and your d1 for the third. IOW you have to construct your "To Point".

Reply to
Michael Bulatovich

The cheating way:

(defun C:MYMOVE ( / ss1 disp) (setq ss1 (ssget) disp (getpoint "\nEnter x,y,z displacement: ") );setq (command ".MOVE" ss1 "" (list 0 0 0) disp) (princ) )

I think you wanted a bit more info, though. At the command line, do this:

(setq testpt (getpoin "\nPick a point, David: "))

Now, still at the command line:

(car testpt)

will give you the x coordinate

(cadr testpt)

will give you the y coordinate

(caddr testpt)

will give you the z coordinate

Pull out the appropriate number, add/subtract your number, then put build the new point with the LIST function. Might look something like;

(setq newpt (list (car oldpt) (cadr oldpt) (+ (caddr oldpt) 5.0)))

This would give newpt a 5.0 unit higher z coordinate.


BTW, I didn't forget about the mech33 thing. I've had a mess of personal issues to deal with. I'll get to it soon, hopefully. Sorry for not getting back to you sooner about that.

Reply to

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.