xspacex Posted November 16, 2009 Posted November 16, 2009 Hello everyone, I am looking into writing a lisp routine that will allow me to select an xref, maybe select multiple xrefs, and then I would be able to change the color of all layers in the xref(s). My question is, if some of the xref layers are bycolor, how would I change these layers to bylayer using the xref name that I will extract from selecting it?? Thanks Quote
xspacex Posted November 19, 2009 Author Posted November 19, 2009 below is the part i am having trouble with... It is suppose to substitute byblock layers to bylayer, however, it is not working. Any suggestions would be appreciated. (setq newclr (cons 62 256)) (setq xrefname (entget (tblobjname "block" (cdr (assoc 2 (entget (car ent))))))) (setq xrefdata (entget xrefname)) (setq oldclr (assoc 62 xrefdata)) (if (assoc 62 xrefdata) (setq xrefent (subst newclr oldclr xrefdata)) (entmod xrefent) ) Quote
VVA Posted November 20, 2009 Posted November 20, 2009 ColorX - change color all object of drawing. All layer unlock and thaw ColorXREF change color xref only on a current session. All layer unlock and thaw ColorXL - change color all object of drawing. Objects on the locked and frozen layers are ignored ColorXREFL change color xref only on a current session. Objects on the locked and frozen layers are ignored COLORXLAY - change xref layer's color Quote
xspacex Posted November 21, 2009 Author Posted November 21, 2009 Hi VVA, thank you for the reply, and posting those links. However, the lisp routines in the old posts do not achieve what i am looking for; in general, they change the xref layers to a specific color... What I am trying to achieve, is basically being able to change xref layers that are forced to a color, to bylayer. Thanks again. Quote
xspacex Posted November 22, 2009 Author Posted November 22, 2009 so i am making some progress, but still not there yet... if i attach an xref to a drawing, i am able to change LINE, ARC, CIRCLE and DTEXT that have a forced color to bylayer, however, if the xref has PLINE, HATCH, ELLIPSE, or MTEXT that have a forced color, i am not able to change these to bylayer. my question is, why isn't my code working for everything, and only working for LINE, DTEXT, CIRCLE and ARC?? Thanks (setq newclr (cons 62 256)) (while (setq blkent (tblnext "block" (null blkent))) (setq blkname (cdr (assoc -2 blkent))) (while blkname (entmod (list (cons -1 blkname) newclr)) (setq blkname (entnext blkname)))) Quote
VVA Posted November 23, 2009 Posted November 23, 2009 Try it (setq newclr (cons 62 256)) (while (setq blkent (tblnext "block" (null blkent))) (setq blkname (cdr (assoc -2 blkent))) (while blkname (entmod (if (assoc 62 (entget blkname)) (subst newclr (assoc 62 (entget blkname)) (entget blkname)) (append (entget blkname) (list newclr)) ) ;_ end of if ) ;_ end of entmod (setq blkname (entnext blkname)) ) ;_ end of while ) ;_ end of while (command "_regenall") Quote
xspacex Posted November 23, 2009 Author Posted November 23, 2009 Hi VVA, Unfortunately, i am still getting the same result. the code will change LINE, ARC, DTEXT, CIRCLE from forced color to bylayer, but it wont change others such as PLINE, MTEXT... any other suggestions? Thanks Quote
tzframpton Posted November 23, 2009 Posted November 23, 2009 Can you just open the XREF and use SETBYLAYER, then save? Quote
xspacex Posted November 23, 2009 Author Posted November 23, 2009 setbylayer will take too long. i can open the xref, open the layer manager, select all layers, and change to bylayer. each project will have multiple xrefs, so i am trying to avoid the drafter from openeing every xref and changing layers to bylayer. also, every time we recieve updates from the architect, the process of opening xrefs and changing colors to bylayer will have to repeated. Quote
xspacex Posted November 24, 2009 Author Posted November 24, 2009 I have an interesting update on this issue. The code that VVA posted, works like a charm in MEP 2008, however, it does not work in MEP 2010. The difference is, in MEP 2010 it only changes LINE and CIRCLE that are forced to a color, to bylayer… Somewhat on the same topic, if I use nentsel to select an xref entity (eg. line, pline, mtext…) and I use entmod to substitute the (cons 62 256) the same thing happens as above. It works flawlessly in 2008, but in 2010 it will only work for LINE and CIRCLE… Any thoughts overall to why this is happening?? Quote
tzframpton Posted November 24, 2009 Posted November 24, 2009 Do you have VBA installed? http://usa.autodesk.com/adsk/servlet/item?siteID=123112&id=12715668&linkID=9240618 Quote
xspacex Posted November 24, 2009 Author Posted November 24, 2009 I do have vba installed, but both routines are lisp, and I don’t think that vba will affect the function of the lisp, but correct me if I’m wrong. Any other ides, because I have no clue what is different in 2010 that will make the lisp routines not work? Thanks 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.