Tharwat Posted July 29, 2011 Share Posted July 29, 2011 Those issues generally only exist when trying to entmod certain properties of newer type entities (MLeader, etc.) or any annotative object, but color/layer/linetype are not of that list. As long as entities' colors being ByLayer it would have nil DXF 62 , that's what I experienced at least . Quote Link to comment Share on other sites More sharing options...
dober Posted July 29, 2011 Share Posted July 29, 2011 @ alanjt Danke Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 29, 2011 Share Posted July 29, 2011 As long as entities' colors being ByLayer it would have nil DXF 62 , that's what I experienced at least . This is not an issue. Consider the following programs to change all primary entities to green. You can either test for the occurrence of the DXF 62 group code, altering it or appending it: (defun c:alltogreen ( / el en ss ) (if (setq ss (ssget "_X")) (while (setq en (ssname ss 0)) (setq el (entget en)) (entmod (if (assoc 62 el) (subst (cons 62 3) (assoc 62 el) el) (append el '((62 . 3))) ) ) (ssdel en ss) ) ) (princ) ) Or, this could be simplified to: (defun c:alltogreen ( / en ss ) (if (setq ss (ssget "_X")) (while (setq en (ssname ss 0)) (entmod (list (cons -1 en) '(62 . 3))) (ssdel en ss) ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 29, 2011 Share Posted July 29, 2011 I did not mean changing entity' color to a specific color but getting an entity's Color when its being ByLayer the DXF 62 would be equal to nil Quote Link to comment Share on other sites More sharing options...
alanjt Posted July 29, 2011 Share Posted July 29, 2011 I did not mean changing entity' color to a specific color but getting an entity's Color when its being ByLayer the DXF 62 would be equal to nil If the return is nil, then get it from the layer's entity dump. (defun color (ename) ((lambda (entityData) (cdr (cond ((assoc 62 entityData)) ((assoc 62 (tblsearch "LAYER" (cdr (assoc 8 entityData))))) ) ) ) (entget ename) ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 29, 2011 Share Posted July 29, 2011 If the return is nil, then get it from the layer's entity dump. 1+ I'd add the abs too: (defun color ( ename ) ( (lambda ( entityData ) (abs (cdr (cond ( (assoc 62 entityData)) ( (assoc 62 (tblsearch "LAYER" (cdr (assoc 8 entityData))))) ) ) ) ) (entget ename) ) ) Quote Link to comment Share on other sites More sharing options...
alanjt Posted July 29, 2011 Share Posted July 29, 2011 1+ I'd add the abs too: (defun color ( ename ) ( (lambda ( entityData ) (abs (cdr (cond ( (assoc 62 entityData)) ( (assoc 62 (tblsearch "LAYER" (cdr (assoc 8 entityData))))) ) ) ) ) (entget ename) ) ) Good point wasn't thinking about off layers, of course, it's kind of difficult to select objects on a layer that's turned off. LoL Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 29, 2011 Share Posted July 29, 2011 Nice work Alan and Lee . Thanks a lot . 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.