0 Members and 1 Guest are viewing this topic.
(cdr (assoc 62 (tblsearch "LAYER" <LayerName>)))
(defun c:CL (/ OB) (if (setq OB (entsel "\nSelect object: ")) (princ (strcat "\nNumber color of object is: " (itoa (cdr (assoc 62 (tblsearch "LAYER" (cdr (assoc 8 (entget (car OB)))) ) ) ) ) ) ) (princ "\n** Nothing selected **") ) (princ))
Thank you very much. Would be perfect if you could display on green, not under command.Thanks again !
Sorry no " green " --->>" screen " Dísplay same my pic upload
(defun c:CL (/ OB) (if (setq OB (entsel "\nSelect object: ")) (alert ;;; replace with princ (strcat....
(defun c:TEst (/ _color ent data) (defun _color (n) (if (numberp n) (cond ((cdr (assoc n '((0 . "ByBlock") (1 . "Red") (2 . "Yellow") (3 . "Green") (4 . "Cyan") (5 . "Blue") (6 . "Magenta") (7 . "White") (256 . "ByLayer") ) ) ) ) ((itoa n)) ) ) ) (if (setq ent (car (entsel "\nSelect object to display layer's color: "))) (alert (strcat "Object Layer: " (cdr (assoc 8 (setq data (entget ent)))) "\nLayer color: " (_color (cdr (assoc 62 (tblsearch "LAYER" (cdr (assoc 8 data)))))) "\nObject color: " (cond ((_color (cdr (assoc 62 data)))) ("ByLayer") ) ) ) ) (princ))
;; CAB version (defun _GetColour ( e / c ) (if (setq c (cdr (assoc 62 e))) (cond ( (cdr (assoc c '( (0 . "ByBlock") (1 . "Red") (2 . "Yellow") (3 . "Green") (4 . "Cyan") (5 . "Blue") (6 . "Magenta") (7 . "White") ) ) ) ) ( (itoa c) ) ) (strcat "ByLayer -> " (itoa (cdr (assoc 62 (tblsearch "LAYER" (cdr (assoc 8 e))))))) ;; CAB change ) )
;; CAB/Irné version(defun _GetColour (e / _GetColorName c) (defun _GetColorName (c) ;Irné change (cond ( (cdr (assoc c '( (0 . "ByBlock") (1 . "Red") (2 . "Yellow") (3 . "Green") (4 . "Cyan") (5 . "Blue") (6 . "Magenta") (7 . "White") ) ) ) ) ((itoa c)) ) ) (if (setq c (cdr (assoc 62 e))) (_GetColorName c) (strcat "ByLayer -> " (_GetColorName (cdr (assoc 62 (tblsearch "LAYER" (cdr (assoc 8 e))))))) ;; CAB change ))
;; CAB/Recursive version(defun _GetColour (e / c) (if (setq c (cdr (assoc 62 e))) (cond ( (cdr (assoc c '( (0 . "ByBlock") (1 . "Red") (2 . "Yellow") (3 . "Green") (4 . "Cyan") (5 . "Blue") (6 . "Magenta") (7 . "White") ) ) ) ) ((itoa c)) ) (strcat "ByLayer -> " (_GetColour (tblsearch "LAYER" (cdr (assoc 8 e))))) ;Irné change to recursive ;; CAB change ))