Message 1 of 20
Flatten all objects regardless their Elevations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Friends,
i have this lisp to flatten all objects inside and outside blocks but i have line with Elevation "3.000E+99" but it seems the lisp does Not flatten it and i have no idea why, If anyone can help to illustrate that to me and update the lisp to flatten all object regardless their elevations .
Thanks in advance.
Drawing with the issue in the attachments.
(defun C:flatall ( / a n ss)
; (vl-load-com)
; flatten objects inside blocks
(vlax-for b (vla-get-blocks (setq a (vla-get-activedocument (vlax-get-acad-object)))) ; select all blocks
(if (= :vlax-false (vla-get-isxref b)) ; ignore xref blocks
(vlax-for o b
(if (vlax-write-enabled-p o) ; chk if object can be moved
(foreach e '(1e99 -1e99)
(vlax-invoke o 'move '(0.0 0.0 0.0) (list 0.0 0.0 e)) ; flatten to 1e99 -1e99 which = 0 elevation
) ; foreach
) ; if
) ; vlax-for
) ; if
) ; vlax-for
; flatten objects outside blocks
(if(setq ss (ssget"_X")) ; select all objects
(progn
(setq ss (mapcar 'vlax-ename->vla-object (mapcar 'cadr (ssnamex ss)))) ; cnvert to list of entities then to vl obj
(foreach i (list 1e99 -1e99)
(mapcar(function(lambda (x) (vla-move x (vlax-3d-point (list 0 0 0)) (vlax-3d-point (list 0 0 i))))) ss) ; flatten to 1e99 -1e99 which = 0 elevation
) ; foreach
) ; progn
) ; if ss
(vla-regen a acallviewports) ; regen
(princ)
) ; defun flatall