hi sir,
i think command draworder doesnt work with nested entities, please try:
(defun c:19 (/ lista o1 o2)
(vl-load-com)
(while
(setq o1
(nentsel
(strcat
"\n Select nested entity to change color to 19. --layer: "
)
)
)
(if o1
(progn
(setq o2 (cdr (assoc 8 (entget (car o1)))))
(if (= o2 "0")
(setq o2 (cdr (assoc 8 (entget (car (cadddr o1))))))
)
;;
;; select all objets on the layer selected above
(setq grabit (ssget "x" (list (cons 8 o2))))
;;
;; change layer color to 19
(command "-layer" "c" 19 o2 "")
(prompt o2)
;;
;; and send to back of draworder
(vl-catch-all-apply
(function
(lambda ()
(vla-MoveToBottom
(vla-AddObject
(vla-GetExtensionDictionary
(vla-item
(vla-get-blocks
(vla-get-ActiveDocument
(vlax-get-acad-object
)
)
)
(cdr (assoc 2
(entget
(cdr (assoc 330 (entget (car o1))))
)
)
)
)
)
"ACAD_SORTENTS"
"AcDbSortentsTable"
)
(vlax-make-variant
(vlax-safearray-fill
(vlax-make-safearray
vlax-vbobject
'(0 . 0)
)
(list (vlax-ename->vla-object
(car o1)
)
)
)
)
)
)
)
)
)
(princ "\n* No entities selected *")
)
(vla-regen (vla-get-activedocument (vlax-get-acad-object))
1
)
)
(princ)
)