Emily_83 Posted October 30, 2008 Posted October 30, 2008 Hi there, i am wondering if anyone knows or has a lisp routine or script to Change Xref/s to all 1 colour in Multiple drawings so say from 253-6?? Cheers Emily Quote
Emily_83 Posted October 30, 2008 Author Posted October 30, 2008 just bumping this back up top, any help would be appreciated, thanks Emily Quote
jammie Posted October 31, 2008 Posted October 31, 2008 Hi Emily_83, Here is a very simple routine to change all xrefs in a drawing to a particular color. Regards, jammie (defun c:xcolor () (command "-layer" "color" (acad_colordlg 1) ;START COLOR DIALOG BOX "*|*" ;FIND ALL XREF'S "" ) ) Quote
Emily_83 Posted November 2, 2008 Author Posted November 2, 2008 Much appreciated Jammie, that will come in real Handy, but can i change that routine to change just 1 xref colour in multiple drawings?? so say i have x-design, and want it colour green in Multiple drawings??? is there a Lisp or script for that?? Cheers Emily Quote
wannabe Posted November 3, 2008 Posted November 3, 2008 Much appreciated Jammie, that will come in real Handy, but can i change that routine to change just 1 xref colour in multiple drawings?? so say i have x-design, and want it colour green in Multiple drawings??? is there a Lisp or script for that?? Cheers Emily I think thay may be a VBA job or another language if you have the access and competence. I would expect you to find this macro for free though tbh if you keep searching. Quote
Emily_83 Posted November 3, 2008 Author Posted November 3, 2008 Thanks Wannabe?? what is tbh?? i am only jsut starting to teach myself to write Lisp routines, don't think i will have the competence :-) but i will keep searching Quote
jammie Posted November 4, 2008 Posted November 4, 2008 Your welcome Emily_83. What you are asking could certainly be achieved through Lisp. Maybe something like this will start you off. Here is a sample routine using visual lisp to chage any xref layer from color 253 to 3. ;ktool xcolor ;11/4/08 ;V.0 (defun c:xcolor ( / acadobj acaddoc acadlays count) (vl-load-com) ;load active x support (setq acadobj (vlax-get-acad-object) ;get autocad acaddoc (vla-get-activeDocument acadobj) ;get active document acadlays (vla-get-layers acaddoc ) ;get layers count 0) ;temporary counter ;set colors (setq color_source 253 ;>> source layer color, can be changed to any color color_target 3 ;>> destination color , can be changed to any color filter "*|*" ) ;>> filter string, xref xref layer contains "|" (vlax-for n acadlays (if (and (wcmatch (vla-get-name n) filter ) ;if it meets the filter (= (vla-get-color n) color_source) ;& if it matches the color ) (progn (vla-put-color n color_target) ;change it to the required color (setq count (1+ count) ;increase counter ) ) ) ) (princ (strcat "\n <"(rtos count 2 0)"> Layer(s) changed from color <" (rtos color_source 2 0)"> to <" (rtos color_target 2 0)">" )) (princ) ) (princ "\nType xcolor to begin :") (princ) Hope this is of some help, Regards Jammie Quote
Emily_83 Posted November 5, 2008 Author Posted November 5, 2008 Awesome Jammie, Thanks for your time, that one is definately useful for another proj i'm on, i am currently trying to modify a lisp routine to change a single xref to any colour i like, but at the moment it is still changing all the xref, i just want it to change the 1 xref i slelct. here it is (defun C:xcolorr () (command (acad_colordlg 1) ;START COLOR DIALOG BOX (sel "\nSelect xref to change: "))) As i have only started on Lisp routines this week, i know it may be completely way off :-P Thanks heaps Emily Quote
Emily_83 Posted November 5, 2008 Author Posted November 5, 2008 where that angry face is that is meant to print C : x .... (but no spaces) Quote
Emily_83 Posted November 5, 2008 Author Posted November 5, 2008 Hey guys i have actually jsut found this routine that Asmi posted, i think it was back in 2007, what the person noted in the post that the routine worked (which it does just what i want it too) but what i need it to do is show the colours changed in the layer manager, could anyone possibly "tweak" this to do that. cheers Emily (defun c:xrcol(/ xSet actDoc nCol blCol blLst) (vl-load-com) (princ "\n>> ") (if (setq xSet(ssget '((0 . "INSERT")))) (if(setq nCol(acad_colordlg 8 nil)) (progn (setq blCol(vla-get-Blocks (setq actDoc(vla-get-ActiveDocument (vlax-get-acad-object)))) blLst(mapcar 'vla-get-Name (mapcar 'vlax-ename->vla-object (vl-remove-if 'listp (mapcar 'cadr(ssnamex xSet))))) ); end setq (while blLst (setq cBl(vla-Item blCol(car blLst)) blLst(cdr blLst) ); end setq (vlax-for i cBl (vl-catch-all-apply 'vla-put-Color(list i nCol)) (if(= "AcDbBlockReference"(vla-get-ObjectName i)) (setq blLst(append blLst (list(vla-get-Name i)))) ); end if ); end vlax-for ); end while (vla-Regen actDoc acAllViewports) ); end progn ); end if ); end if (vl-load-com) ); end of c:xrcol 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.