gamage,
You're welcome, glad I could help.
Here is one quick remark, I just added Lee Macs undo commands.
Whit these commands, if You need to use undo, it is not going to go step by step trough lisp.
(defun c:ssunion (/ ss ssunion ename)
(defun *error* ( msg )
(LM:endundo (LM:acdoc))
(if (not (wcmatch (strcase msg t) "*break,*cancel*,*exit*"))
(princ (strcat "\nError: " msg))
)
(princ)
)
(LM:startundo (LM:acdoc))
(setq ss (ssget '((-4 . "<OR")
(0 . "LWPOLYLINE")
(0 . "HATCH")
(-4 . "OR>")))
)
(setq ssunion (ssadd))
(while (setq ename (ssname ss 0))
(cond
((= "HATCH" (cdr (assoc 0 (entget ename))))
(command "-hatchedit" ename "b" "r" "n")
)
((= "LWPOLYLINE" (cdr (assoc 0 (entget ename))))
(command "region" ename "")
)
);end cond
(ssdel ename ss)
(ssadd (entlast) ssunion )
)
(command "union" ssunion "")
(LM:endundo (LM:acdoc))
)
;; Start Undo - Lee Mac
;; Opens an Undo Group.
(defun LM:startundo ( doc )
(LM:endundo doc)
(vla-startundomark doc)
)
;; End Undo - Lee Mac
;; Closes an Undo Group.
(defun LM:endundo ( doc )
(while (= 8 (logand 8 (getvar 'undoctl)))
(vla-endundomark doc)
)
)
;; Active Document - Lee Mac
;; Returns the VLA Active Document Object
(defun LM:acdoc nil
(eval (list 'defun 'LM:acdoc 'nil (vla-get-activedocument (vlax-get-acad-object))))
(LM:acdoc)
)
dicra