One more question.
I am using the code for IMAGE and GEOMAPIMAGE.
Are they any other types of image or raster except these?
(0 . "*IMAGE*")
(defun c:I2B (/)
(setvar "cmdecho" 0)
(setq SS_IMAGE nil)
(setq SS_IMAGE (ssget "X" '((0 . "IMAGE"))))
(if (= SS_IMAGE nil)
(princ "\nNo images in drawing")
(progn
(command "draworder" SS_IMAGE "" "back" )
(setvar "cmdecho" 1)
(princ "\n ************************************")
(princ "\n *** All IMAGES moved to back !! ***")
(princ "\n ************************************")
);progn
);if
(princ)
);defun
Add (410 . "Model") to the ssget filter list.
(defun c:HAB (/) (c:HIB))
(defun c:HIB (/ *error* _catch u lock e s ss i lst r)
;; send all Hatch and Images Back (draworder)
;; Alan J. Thompson, 12.23.10 | 2016.09.09
(defun *error* (msg)
(foreach l lock (vla-put-lock l :vlax-true))
(if r
(vla-regen *AcadDoc*
(if (eq (getvar 'CVPORT) 1)
acAllViewports
acActiveViewport
)
)
)
(and u (vla-endundomark *AcadDoc*))
(if (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*QUIT*,")))
(progn (vl-bt) (princ (strcat "\nError: " msg)))
)
)
(defun _catch (f a / r)
(if (not (vl-catch-all-error-p (setq r (vl-catch-all-apply f a))))
r
)
)
(setq u (not (vla-startundomark
(cond (*AcadDoc*)
(setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object)))
)
)
)
)
(vlax-for lay (vla-get-layers *AcadDoc*)
(if (eq (vla-get-lock lay) :vlax-true)
(vla-put-lock (car (setq lock (cons lay lock))) :vlax-false)
)
)
(setq e (vla-getextensiondictionary (vla-get-modelspace *AcadDoc*))
s (cond ((_catch 'vla-getobject (list e "acad_sortents")))
((_catch 'vla-getobject (list e "acad_sortents" "acdbsortentstable")))
)
)
(foreach pair '((0 . "HATCH") (0 . "IMAGE,OLE2FRAME,PDFUNDERLAY"))
(if (setq ss (ssget "_X" (list pair '(410 . "Model"))))
(progn
(repeat (setq i (sslength ss))
(setq lst (cons (vlax-ename->vla-object (ssname ss (setq i (1- i)))) lst))
)
(vlax-invoke s 'MoveToBottom lst)
(setq r t
lst nil
)
)
)
)
(*error* nil)
(princ)
)
(vl-load-com)
(princ)
You may also be interested in these resources:Pretty slick.
Draw Order Reactor (http://bit.ly/HfLNJR)