Dayananda Posted December 19, 2019 Posted December 19, 2019 (setq pt1 (getpoint)) (setq pt2 (getpoint)) (setq xss2 (ssget"C" pt1 pt2 '((0 . "INSERT") ))) (if xss2 (repeat (setq i (sslength xss2)) (setq obj (tblobjname "BLOCK" (cdr (assoc 2 (entget (ssname xss2 (setq i (1- i)))))))) (while (setq obj (entnext obj)) (and (= (cdr (assoc 0 (setq get (entget obj)))) "CIRCLE") (print (cdr (assoc 40 get)))) ) ) ) I need to modify the above code to change the color all entities inside the blocks to red. Please do not use visual lisp codes . Quote
dlanorh Posted December 19, 2019 Posted December 19, 2019 (edited) Try this (defun c:test ( / xss2 i obj ent lst) (setq xss2 (ssget '((0 . "INSERT") ))) (if xss2 (repeat (setq i (sslength xss2)) (setq obj (tblobjname "BLOCK" (cdr (assoc 2 (entget (setq ent (ssname xss2 (setq i (1- i))))))))) (while (setq obj (entnext obj)) (setq lst (entget obj)) (if (cdr (assoc 62 lst)) (entmod (subst (cons 62 1) (assoc 62 lst) lst)) (entmod (append lst '((62 . 1))))) ) (entupd ent) ) ) ) I'll leave the integration up to you You do know you are changing the block DEFINITION here? Edited December 19, 2019 by dlanorh 1 Quote
ronjonp Posted December 19, 2019 Posted December 19, 2019 @dlanorh AFAIK you don't need to check for code 62. The append will work since it's the last thing read in the list. On the flip side I've seen items with truecolor /colorbook set (420/430 codes) and subst 62 does nothing. Quote
Lee Mac Posted December 19, 2019 Posted December 19, 2019 (edited) Here's a similar program from 4 years ago - this will process primary & nested blocks (nested to any level). Edited December 19, 2019 by Lee Mac Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.