Change elevation of object based on another

Change elevation of object based on another

projektiranje88
Explorer Explorer
294 Views
4 Replies
Message 1 of 5

Change elevation of object based on another

projektiranje88
Explorer
Explorer

Hi,

is there a lisp that I can use to change the elevation of an object based on the selection of another object?
For example, object 1 has an elevation of 0, and object 2 has an elevation of 155, I want object 1 to change elevation based on the selection of object 2.
Of course, the X and Y coordinates of object 1 must not change.

 

Best regards,

Mladen

0 Likes
Accepted solutions (1)
295 Views
4 Replies
Replies (4)
Message 2 of 5

paullimapa
Mentor
Mentor
0 Likes
Message 3 of 5

projektiranje88
Explorer
Explorer

Not work for my case.

 

Please see dwg in the attachment.

 

br

0 Likes
Message 4 of 5

ВeekeeCZ
Consultant
Consultant
Accepted solution

Try this code.

 

(defun c:Zmatch ( / s d)
  
  (and (setq s (car (entsel "\nSource: ")))
       (setq s (last (assoc 10 (entget s))))
       (setq d (car (entsel (strcat "\nObject to apply z=" (rtos s) " to: "))))
       (setq d (entget d))
       (entmod (subst (reverse (cons s (cdr (reverse (assoc 10 d))))) (assoc 10 d) d))
       )
  (princ)
  )

 

Message 5 of 5

projektiranje88
Explorer
Explorer
It's work!



Than you!



br
0 Likes