Allflat.lsp mesh with dinamic blocks

Allflat.lsp mesh with dinamic blocks

kibitotato
Advocate Advocate
258 Views
4 Replies
Message 1 of 5

Allflat.lsp mesh with dinamic blocks

kibitotato
Advocate
Advocate

Found this code from Lee Mac on this site https://www.cadtutor.net/forum/topic/49101-automate-flattening-all-entities-residing-inside-blocks/

The problem is tha this lisp makes a mess with dinamic blocks...

 

Attached 2 files after and before using allflat

 

 

 

(defun c:allflat ( / d )
   (vlax-for b (vla-get-blocks (setq d (vla-get-activedocument (vlax-get-acad-object))))
       (if (= :vlax-false (vla-get-isxref b))
           (vlax-for o b
               (if (vlax-write-enabled-p o)
                   (foreach e '(1e99 -1e99)
                       (vlax-invoke o 'move '(0.0 0.0 0.0) (list 0.0 0.0 e))
                   )
               )
           )
       )
   )
   (vla-regen d acallviewports)
   (princ)
)
(vl-load-com) (princ)

 

 

 Any ideas how to fix this?

0 Likes
259 Views
4 Replies
Replies (4)
Message 2 of 5

ВeekeeCZ
Consultant
Consultant

Not sure what desired outcome is, but I would convert all dynblocks to the "static" ones first. 

0 Likes
Message 3 of 5

kibitotato
Advocate
Advocate

I want to flat every object in the .dwg. The lisp works very fine but it also transformates the dinamic blocks and I can´t make it "static".
The point is move every Z coordinate of every object and block (even objetc inside blocks, arrays and objets inside arrays...) to z=0

0 Likes
Message 4 of 5

pendean
Community Legend
Community Legend
@kibitotato very few tools that do all you want leave Dynamic Blocks intact. Sorry, just another limitation of that object type.
0 Likes
Message 5 of 5

kibitotato
Advocate
Advocate
OK, so there is no solution possible for this thing... Thanks!!!
0 Likes