gmmdinesh Posted June 8, 2018 Author Posted June 8, 2018 I have tested with the same file which i already posted on Post#7 Quote
Tharwat Posted June 8, 2018 Posted June 8, 2018 That txt file has one line of data and the handle there does not match any of the attributed blocks in the drawing so no wonder the program did nothing since it did not match any of the handle strings of the existed blocks. Quote
gmmdinesh Posted June 8, 2018 Author Posted June 8, 2018 Could you please check the sample file? Att.txt Sample.dwg Quote
Tharwat Posted June 8, 2018 Posted June 8, 2018 You have an extra apostrophe in every handle string in the txt file and that is the issue. Quote
gmmdinesh Posted June 8, 2018 Author Posted June 8, 2018 But the Text, i have get using ATTOUT Command. I't is came like that only. Usually it's coming one apostrophe right? Please give me the corrected text file if you have. Quote
Tharwat Posted June 8, 2018 Posted June 8, 2018 If that is the case then just replace the following line of codes with the related codes from the program and try it gain. (setq soc (assoc (strcat "'" (cdr (assoc 5 (entget ent)))) lst)) Quote
gmmdinesh Posted June 8, 2018 Author Posted June 8, 2018 Awsome!!! It's working perfectly, Thank you so much for your valuable support. Thank you so much. Quote
BIGAL Posted June 9, 2018 Posted June 9, 2018 My $0.05 why would you not move your directory up the tree ? like "B:\Lisp" you are making hard work for your self remembering that path. Just add it to the support paths as well using CONFIG. Quote
gmmdinesh Posted November 13, 2018 Author Posted November 13, 2018 (edited) Hello Guys, I have used the lisp for last five months and it was working Perfectly. Recently i got Reset my AutoCAD, when i try to run the lisp after resetting my Autocad i got the below Error. Anyone Please help me , why the error is came and how to Solve this.? Error => bad argument type: stringp nil (defun c:AutoAttsUpd ( / *error* _peelstring txt dir opn lst str sel int ent soc pos) ;; Tharwat - 07.Jun.2018 ;; (defun *error* (msg) (and opn (close opn)) (and msg (not (wcmatch (strcase msg) "*BREAK*,*CANCEL*,*EXIT*")) (princ (strcat "\nError => " msg )) ) ) ; (setq txt "Att") ;; text File name ..... <--- REMOVE THIS LINE FROM THE PROGRAM SINCE YOU DON'T NEED IT ANYMORE. (if (and (setq dir "B:\\AppData\\Local\\Autodesk\\Autodesk AutoCAD Map 3D 2014\\R19.1\\enu\\LISP\\901.txt") ;; YOU SHOULD HAVE THE PATH WITH TWO BACK SLASHES OR ONE FORWARD SLASH. (or (findfile dir) (alert (strcat "Text file was not found in current path => " dir)) ) (setq opn (open dir "r")) (read-line opn) ) (progn (defun _peelstring (string del / str pos lst) (while (setq pos (vl-string-search del string 0)) (setq str (substr string 1 pos) string (substr string (+ pos (1+ (strlen del)))) ) (and str (/= str "") (setq lst (cons str lst))) ) (and string (/= string "") (setq lst (cons string lst))) (reverse lst) ) (while (setq str (read-line opn)) (setq lst (cons (_peelstring str "\t") lst)) ) (and (setq int -1 sel (ssget "_X" (list '(0 . "INSERT") '(66 . 1) (cons 2 (apply 'strcat (mapcar '(lambda (u) (strcat (cadr u) ",")) lst)))))) (while (setq ent (ssname sel (setq int (1+ int)))) (and (setq soc (assoc (strcat "'" (cdr (assoc 5 (entget ent)))) lst)) (setq soc (cddr soc) pos -1) (princ "\nProcessing ...") (mapcar '(lambda (x) (vla-put-textstring x (nth (setq pos (1+ pos)) soc))) (vlax-invoke (vlax-ename->vla-object ent) 'getattributes)) ) ) ) ) ) (*error* nil) (princ) ) Thanks Edited November 13, 2018 by gmmdinesh Quote
Tharwat Posted November 14, 2018 Posted November 14, 2018 Hi, Just a shot in the dark so try to reverse the following codes and I assume is that you have one of the attributes is equal to empty string (eg: ""). (setq soc (cddr soc) pos -1) to be like this: (setq pos -1 soc (cddr soc) ) If the above update did not solve the issue, just upload a real example to allow me to take a close look at the drawing & txt file. Quote
gmmdinesh Posted November 19, 2018 Author Posted November 19, 2018 Hi Tharwat, Again i got the Same error. Please look the attached files. Sample.dwg Title Block.txt Quote
Tharwat Posted November 19, 2018 Posted November 19, 2018 Hi, Its working for me without any issue at all. Are you sure is the path that included in the program is the same path to the txt file you uploaded here? Quote
gmmdinesh Posted November 19, 2018 Author Posted November 19, 2018 Quote Are you sure is the path that included in the program is the same path to the txt file you uploaded here? Yes. I have the Text file in the Same Path which i mentioned in the Programme. Quote
gmmdinesh Posted November 19, 2018 Author Posted November 19, 2018 Yeah. It seems working perfectly for you... but i don't know why it's not working for me... Actually what is the mean of above error.? Quote
Tharwat Posted November 19, 2018 Posted November 19, 2018 4 hours ago, gmmdinesh said: Actually what is the mean of above error.? It means is that your argument supposed to be a string but the given argument is with another type. Quote
gmmdinesh Posted November 20, 2018 Author Posted November 20, 2018 Okay... let me try my side. Thanks for your help... Quote
gmmdinesh Posted August 1, 2019 Author Posted August 1, 2019 Hello @Tharwat I have used this Routine for a year...but now i got an error when running to New Template.. I found the issue...If i run the script on *.dwt file (Directly opens in AutoCAD) this Script updates the attributes in all the Layouts. (12 Layouts). If i insert the Template/Layout on another *.dwg file , the script is not update anything. While inserting the Layouts the Handle name of the Attributes getting changed. Can you help me to solve this Issue. Quote
gmmdinesh Posted August 2, 2019 Author Posted August 2, 2019 Hello Everyone... Could anyone please help me out on this... Thanks in advance 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.