Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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

Posted

Awsome, It is exactly what I was looking for

 

Thanks Again,

 

Patrick

Posted

you can do any of the 3 x y z

 

x rd (strcat rz ",0,0" )

y rd (strcat "0," rz ",0" )

  • 1 year later...
Posted
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.

Posted

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))

Posted
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.

Posted

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.

Posted

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.

Posted

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))

Posted

Lee, I get this:

Command: mvz

Select objects: 1 found

Select objects:

Select Text for Z Coord: ; error: bad argument type: numberp:

Posted

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... :P

 

(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))

Posted

No problem Phiphi, it was a stupid mistake on my part :oops:

 

Glad it works now :)

 

Lee

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...