Jump to content

Recommended Posts

Posted

I have tested with the same file which i already posted on Post#7

  • Replies 39
  • Created
  • Last Reply

Top Posters In This Topic

  • gmmdinesh

    19

  • Tharwat

    12

  • rlx

    6

  • BIGAL

    2

Top Posters In This Topic

Posted Images

Posted

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.

Posted

You have an extra apostrophe in every handle string in the txt file and that is the issue. ;)

Posted

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.

Posted

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)) 

Posted

Awsome!!!

It's working perfectly, Thank you so much for your valuable support.

Thank you so much.:D

Posted

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.

  • 5 months later...
Posted (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 by gmmdinesh
Posted

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.

Posted

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?

Posted
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.

Posted

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.?

Posted
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.

Posted

Okay... let me try my side.

Thanks for your help...

  • 8 months later...
Posted

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.

Posted

Hello Everyone...

Could anyone please help me out on this...

 

 

Thanks in advance

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...