pman860507 Posted March 13, 2012 Posted March 13, 2012 Recently i have been having issues with this lisp file. A close out of the drawing and opening it back up solves this problems. Which to me is really not a solution. I got this code from this forum just modified it for my use. This is the error im getting. Error: bad argument type: stringp (-1 . <Entity name: 7eb03b20>) It's coming from this line of code. (cons 2 (apply 'strcat (cdr b))) I just don't know why. I'm sure its something easy. Thanks. (defun c:XREF_LAYER () ;( / a b c d lay_lst ) (defun *Error* (Msg) (cond ((member Msg '("Function cancelled" "quit / exit abort"))) ((princ (strcat "Error: " Msg)) (princ "\nRestoring System Variables ") (terpri))) (princ)) (vl-load-com) (vlax-for lay (vla-get-Layers(vla-get-Activedocument (vlax-get-acad-object))) (if (= :vlax-true(vla-get-lock lay)) (progn (vla-put-lock lay :vlax-false) (setq lay_lst (cons lay lay_lst)) ) ) ) (initget "ME-ANNO-XREF E-ANNO-XREF M-ANNO-XREF P-ANNO-XREF T-ANNO-XREF F-ANNO-XREF") (setq *layr* (cond ( (getkword(strcat "\nChoose Layer [ME/M/E/P/T/F] <"(setq *layr*(cond ( *layr* ) ( "ME-ANNO-XREF" ))) ">: ")) ) ( *layr* ) ) ) (while (setq a (tblnext "BLOCK" (null a))) (if (= 4 (logand 4 (cdr (assoc 70 a)))) (setq b (cons "," (cons (cdr (assoc 2 a)) b))) ) ) (if (setq c (ssget "_X" (list (cons 0 "INSERT") (cons 2 (apply 'strcat (cdr b))) (cons 8 (strcat "~" *layr*)) ) ) ) (repeat (setq d (sslength c)) (entmod (list (cons -1 (ssname c (setq d (1- d)))) (cons 8 *layr*))) ) ) (if lay_lst(foreach l lay_lst(vla-put-lock l :vlax-true))(princ "No layers to restore")) (command "purge" "all" "" "n") (command "layer" "LO" *layr* "") (princ) ) Quote
Lee Mac Posted March 13, 2012 Posted March 13, 2012 Why have you commented the local variables?!? Quote
pman860507 Posted March 13, 2012 Author Posted March 13, 2012 Sorry i did that so i could see the variables when it was getting an error. Looks like i forgot to change it back. I do think i was getting the errors before this though. I will check, but i dont know what is actually make this error out in the drawing. Quote
Lee Mac Posted March 13, 2012 Posted March 13, 2012 Are you sure that you have correctly identified the line on which the code throws an error? I say this because the error message doesn't seem to match the data held by that variable. Did you follow this procedure to identify the source of the error? Quote
pman860507 Posted March 13, 2012 Author Posted March 13, 2012 I cant say that I'm 100% sure. When i got the error I went though each line of code via command line. this is the line that give me the error. I figured it could be something before not working right and sending the wrong variable to that line. I did not follow that. first i have actually seen it. I will do so the next time i get the error. One more thing. Thats awesome debugging LEE. 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.