420325 Posted November 13, 2007 Posted November 13, 2007 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 Quote
lpseifert Posted November 13, 2007 Posted November 13, 2007 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 Quote
420325 Posted November 13, 2007 Author Posted November 13, 2007 Thanks, Im new to the whole LISP process but it should help me get some work done faster. Quote
420325 Posted November 13, 2007 Author Posted November 13, 2007 Awsome, It is exactly what I was looking for Thanks Again, Patrick Quote
BIGAL Posted November 14, 2007 Posted November 14, 2007 you can do any of the 3 x y z x rd (strcat rz ",0,0" ) y rd (strcat "0," rz ",0" ) Quote
Phiphi Posted March 18, 2009 Posted March 18, 2009 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 Can you please add an option to pick the value of Z as well. Thank you. Quote
Lee Mac Posted March 18, 2009 Posted March 18, 2009 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)) Quote
Phiphi Posted March 20, 2009 Posted March 20, 2009 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)) Thanks Lee, but it does not work. Lisp must request to pick a text of Z value first. Quote
Lee Mac Posted March 20, 2009 Posted March 20, 2009 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. Quote
Phiphi Posted March 21, 2009 Posted March 21, 2009 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. Quote
Lee Mac Posted March 21, 2009 Posted March 21, 2009 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)) Quote
Phiphi Posted March 23, 2009 Posted March 23, 2009 Lee, I get this: Command: mvz Select objects: 1 found Select objects: Select Text for Z Coord: ; error: bad argument type: numberp: Quote
Lee Mac Posted March 23, 2009 Posted March 23, 2009 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)) Quote
Lee Mac Posted March 23, 2009 Posted March 23, 2009 No problem Phiphi, it was a stupid mistake on my part Glad it works now Lee Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.