Originally Posted by
pangell
Yes I can do that but, only one at a time which will take for ever. I would like all at one time.
Here is a bit of code to change the blocks that have been changed from the Express Tools Flatten command. This will replace the "flatten"ed blocks to the original block definition (without the *-flat-* block name) before the flatten command was executed on the blocks., as long as the original block definition is still within the drawing.
Code:
(defun C:FIXAFLAT ()
(setq SSET (ssget "x" (list (cons 2 "*-flat-*")))
CNT 0
)
(if SSET
(progn
(repeat (sslength SSET)
(setq ENTITY (entget (ssname SSET CNT))
BNAME (cdr (assoc 2 ENTITY))
BNAMECNT (vl-string-search "-flat-" BNAME 0)
BNAMEBASE (substr BNAME 1 BNAMECNT)
CNT (1+ CNT)
)
(if (tblsearch "BLOCK" BNAMEBASE)
(progn
(setq ENTITY (subst (cons 2 BNAMEBASE) (assoc 2 ENTITY) ENTITY))
(entmod ENTITY)
(command "_purge" "Blocks" bname "No")
(while (= 1 (getvar "cmdactive"))
(command "")
)
)
)
)
)
)
(princ)
)
Let me know if you have any problems with this. It does not contain any error handling. It has been tested, but only a little.
HTH