Lee Mac 发表于 2022-7-6 15:36:50

Maybe this:
 

(defun c:mvz(/ ss1 rz rd) (if (and(setq ss1 (ssget)         txt (car (entsel "\nSelect Text for Z Coord: "))))   (progn   rd(strcat "0,0," (rtos (cdr (assoc 1 (entget txt)))))   (command "move" ss1 "" "0,0,0" rd))   (princ "\n Error in Selections ")) (princ))

Phiphi 发表于 2022-7-6 15:42:29

Lee, I get this:
Command: mvz
Select objects: 1 found
Select objects:
Select Text for Z Coord: ; error: bad argument type: numberp:

Lee Mac 发表于 2022-7-6 15:45:42

Haha... I'm a moron.... the text you are selecting is already a string and not a number... so I was trying to convert a string to a string...
 

(defun c:mvz(/ ss1 rz rd) (if (and(setq ss1 (ssget)         txt (car (entsel "\nSelect Text for Z Coord: "))))   (progn   (setq rd (strcat "0,0," (cdr (assoc 1 (entget txt)))))   (command "move" ss1 "" "0,0,0" rd))   (princ "\n Error in Selections ")) (princ))

Phiphi 发表于 2022-7-6 15:52:05

All right now. Thank a lot, Lee.

Lee Mac 发表于 2022-7-6 15:53:55

No problem Phiphi, it was a stupid mistake on my part
 
Glad it works now
 
Lee
页: 1 [2]
查看完整版本: AutoLISP Move only Z-Coord.?