420325 发表于 2022-7-6 14:53:40

AutoLISP Move only Z-Coord.?

I am trying to find or build a LISP that will move any object that is selected in the Z-Coord. I know many ways to change the elevation of an object I would just like to be able to run a command other than move @0,0,?
 
thanks

lpseifert 发表于 2022-7-6 15:00:52

Here's something to get you started:

(defun c:mvz ()(setq ss1 (ssget)      rz (rtos (getreal "Enter relative Z distance: "))      rd (strcat "0,0," rz));setq(command "move" ss1 "" "0,0,0" rd));defun

420325 发表于 2022-7-6 15:06:05

Thanks, Im new to the whole LISP process but it should help me get some work done faster.

420325 发表于 2022-7-6 15:08:30

Awsome, It is exactly what I was looking for
 
Thanks Again,
 
Patrick

BIGAL 发表于 2022-7-6 15:13:52

you can do any of the 3 x y z
 
xrd (strcat rz ",0,0" )
yrd (strcat "0," rz ",0" )

Phiphi 发表于 2022-7-6 15:17:21

Can you please add an option to pick the value of Z as well. Thank you.

Lee Mac 发表于 2022-7-6 15:21:56

Perhaps :
 

(defun c:mvz(/ ss1 rz rd) (setq    ss1 (ssget)   rz(rtos (getdist "Enter relative Z distance: "))   rd(strcat "0,0," rz)) (command "move" ss1 "" "0,0,0" rd) (princ))

Phiphi 发表于 2022-7-6 15:26:04

Thanks Lee, but it does not work.
Lisp must request to pick a text of Z value first.

Lee Mac 发表于 2022-7-6 15:31:17

This works in the same way as previously posted, except the user can click and specify a distance on screen. I'm not quite sure what you were expecting, but if you could clarify things it'd make it much easier.

Phiphi 发表于 2022-7-6 15:34:13

If there are some text: 3.45, 2.55 ...in drawing. We just select this number but not have to "Enter relative Z distance". Cheers.
页: [1] 2
查看完整版本: AutoLISP Move only Z-Coord.?