Juergen Posted April 26, 2018 Share Posted April 26, 2018 Hi users, I´m looking to get the color bookname and color name from selected hatch and write the name as text into the drawing. (see images) Can anybody help. Thanks. Juergen. Quote Link to comment Share on other sites More sharing options...
ronjonp Posted April 26, 2018 Share Posted April 26, 2018 Here's a hint: (if (setq e (car (entsel))) (alert (vl-princ-to-string (cdr (assoc 430 (entget e))))) ) Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted April 26, 2018 Share Posted April 26, 2018 Will it always be a ColorBook color? Or could it be an ACI color or RGB? Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted April 26, 2018 Share Posted April 26, 2018 Another, which should account for everything... (defun objectcolour ( enx / col ) (cond ( (cdr (assoc 430 enx))) ( (setq col (cdr (assoc 420 enx))) (mapcar '(lambda ( x ) (lsh (lsh (fix col) x) -24)) '(8 16 24)) ) ( (setq col (cdr (assoc 62 enx)))) ( (objectcolour (entget (tblobjname "layer" (cdr (assoc 8 enx)))))) ) ) To test: (defun c:test ( / ent ) (if (setq ent (car (entsel))) (print (objectcolour (entget ent))) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted April 26, 2018 Share Posted April 26, 2018 Nice @Lee Mac Quote Link to comment Share on other sites More sharing options...
Juergen Posted April 27, 2018 Author Share Posted April 27, 2018 Hi ronjonp, hi Lee, tanks for your help. It helps me a lot to learn more about lisp. @rkmcswain: yes it´s always a ColorBook color. (I need it to title our color palette) Quote Link to comment Share on other sites More sharing options...
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.