reset z points

hi everyone,

a lisp is available but not fully working. What I want is for all kinds of objects (line, block, text.....) to come to the z axis without noticing in the 2d drawing, with the command to return the z values ​​to zero. actually it should auto-select the entire drawing
Could you please help about this topic that I need. ?

(defun c:z_reset ()
(princ "\nSelect Entities to Reset :")
(setq objects (ssget))
; (setq obje (ssget "x" '((0 . "LINE"))))
(setq n (sslength obje))
(setq i 0)
(princ "\nResetting in progress\n")
(repeat n
(setq ename (ssname obje i))
(setq elist (entget ename))
(setq bas (cdr (assoc 10 elist))
son (cdr (assoc 11 elist))
basx (car bas)
basy (cadr bas)
sonx (car son)
sony (cadr son)
)
(setq bas (list basx basy 0.0) son (list sonx sony 0.0))
(setq elist (subst (cons 10 bas) (assoc 10 elist) elist))
(setq elist (subst (cons 11 son) (assoc 11 elist) elist))

(entmod elist)
(setq i (+ i 1))
(sayac i n));repeat
(defun overkill)
(command "_.overkill")
(princ (strcat "\n" (itoa i) " object's Z's are reset."))
( defun save)
(command "._qsave")
(princ)
)


Comments