GlnGrnr Posted October 10, 2013 Author Posted October 10, 2013 Hi Lee Mac that looks great but when i load the lisp through appload and then type xc into the comman line it does not do anything? am I loading it wrong? Quote
Lee Mac Posted October 10, 2013 Posted October 10, 2013 I see no error in the code (unless I have missed something) - I can only assume that matches are found with your layer names... Quote
GlnGrnr Posted October 10, 2013 Author Posted October 10, 2013 i think you may be right, i dont think it has found the xrefs loaded into the drawing as a match. could it be the wildcard (*) Quote
Lee Mac Posted October 10, 2013 Posted October 10, 2013 Do your xref-dependent layers appear in the format |? Quote
GlnGrnr Posted October 10, 2013 Author Posted October 10, 2013 Yes thats right | i am ot sure why it wont run as i cannot see the issue either, i have even tried renaming the xref list to match that of the drawing but still no joy, thanks for all your help so far means alot with a project this size Quote
pBe Posted October 10, 2013 Posted October 10, 2013 Still using command: Layer (defun c:xcs (/ a col xrs nme p col) (setvar 'cmdecho 0) (setq lst '(("AC" . 1) ("_BM" . 2) ("_CL" . 3) ("_EC" . 4) ("_FE" . 5) ("_FL" . 6) ("_FP" . 7) ("_GC" . 11) ("_HD" . 41) ("_HO" . 71) ("_HW" . 91) ("_MW" . 121) ("_PA" . 151) ("_RE" . 171) ("_RP" . 191) ("_SL" . 211) ("_TL" . 241) ("_ZA" . 222) ("_ZB" . 144) ("_ZC" . 30) ) ) (while (setq a (tblnext "block" (not a))) (if (and (setq nme (cdr (assoc 1 a))) (setq p (vl-string-position 95 (setq sf (vl-filename-base nme)) nil t ) ) (setq col (assoc (substr sf (1+ p)) lst)) ) (command "_layer" "_color" (cdr col) (strcat sf "|*") "" ) ) ) (princ) ) Quote
Tharwat Posted October 10, 2013 Posted October 10, 2013 Try this UNTESTED codes and let me know . (vl-load-com) (defun c:Test (/ l doc) (setq l '((1 "0618__AC") (2 "0618__BM") (3 "0618__CL") (4 "0618__EC") (5 "0618__FE") (6 "0618__FL") (7 "0618__FP") (11 "0618__GC") (41 "0618__HD") (71 "0618__HO") (91 "0618__HW") (121 "0618__MW") (151 "0618__PA") (171 "0618__RE") (191 "0618__RP") (211 "0618__SL") (241 "0618__TL") (222 "0618__ZA") (144 "0618__ZB") (30 "0618__ZC") ) ) (vlax-for x (vla-get-layers (setq doc (vla-get-activedocument (vlax-get-acad-object))) ) (foreach xr l (if (wcmatch (strcase (vla-get-name x)) (strcat (cadr xr) "|*")) (vla-put-color x (car xr)) ) ) ) (vla-regen doc acAllViewports) (princ) ) Quote
GlnGrnr Posted October 11, 2013 Author Posted October 11, 2013 pBe, code works fantastic, thankyou everyone for your help on this you have just saved me approximately 35 days of work load. ) i have been trying to learn lsp but have been so over loaded with work I have nto got much further than the tutorials. once again thanks for your help Quote
Tharwat Posted October 11, 2013 Posted October 11, 2013 I see you took over my codes without even a blink . Quote
SLW210 Posted October 11, 2013 Posted October 11, 2013 Please read the Code posting guidelines and edit your Codes to include Code Tags. You have also overlooked my post, please add Code Tags to your Code. 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.