Jump to content

Attribute Text Change LISP??


Recommended Posts

Posted

I was just wondering if anyone knows of a LISP file that I can run that will find a Tag within a block and change the Value to whatever I want to change it to? I have a bunch of block in my drawings and I keep the Tags within them very descriptive, and somtimes I keep the Values blank or generic so I can Find a Replace throughout a drawing, but I want to get a LISP that can do this so I can use a script to run it on a bunch of drawings at a time. I don't think I can use the Find command because it will always pop-up the window to enter the text to find and replace.

Posted

The following will allow the user to update the revision letter in an attribute by prompting the user for the "New Revision Letter".

It looks for all attribute tags named "REV" or "REV_LETTER" in all layouts.

 

You could modify this easily for your use.

Hope this helps.

 

 

 

(defun c:UPATT (/ e ez att enn en ptcnt pscnt SSET)
(SETQ ATT# (GETSTRING T "\New Revision Letter <ENTER for none>: "))
(IF (= SSET NIL)
(SETQ SSET (SSGET "X" (list (CONS 0 "INSERT") (CONS 66 1) ) ) ) )
(if sset
(progn
(PROMPT "\nUpdating.......please wait. ")
(SETQ SEL_CNT (SSLENGTH SSET))
(SETQ ATT "ATTRIB")
(setq ptcnt 0 pscnt (sslength sset))
(while (< ptcnt pscnt)
(if (= "INSERT"
(cdr (assoc 0 (setq ez (setq e (entget (ssname sset ptcnt)))))))
(progn
(setq enn (cdr (car e)))
(IF (= (CDR (ASSOC 66 E)) 1)
(PROGN
(while (= ATT "ATTRIB")
(if (= "ATTRIB"
(setq ATT (cdr (assoc 0 (setq e (entget (setq en (entnext (cdr (car e))))))))))
(progn

(if (or (= "REV" (CDR (ASSOC 2 E )))(= "REV_LETTER" (CDR (ASSOC 2 E ))))


(PROGN
(SETQ ENN (CDR (CAR E)))
(SETQ TSC (ASSOC 1 E))
(SETQ TT ATT#)
(SETQ E (SUBST (CONS 1 TT) TSC E))
(ENTMOD E)
(ENTUPD ENN)
) () )
) ()
)
) (setq ATT "ATTRIB" ptcnt (+ ptcnt 1))
) (setq ptcnt (+ ptcnt 1) ) )
) (setq ptcnt (+ ptcnt 1) ) ; PROGN
) ; IF INSERT
) ;WHILE
) () ) ;IF SSET AND PROGN
(SETQ SSET ())
(SETVAR "HIGHLIGHT" 1)
(PRINC)
);defun

Posted

I will give this a try... Thanks!

Posted

Have you tried using command gatte to do what you want?

Posted

I have never heard of this command and can not find it in the help files... Can you tell me more about it so I can see if I can use it?

Posted

No need to answer my last message... I figured it out... I believe with what I know about scripting and LISP file creation, I should be able to use this "GATTE" command to do what I would like... Thanks for the help guys.

Posted

Gatte isnt a command but it's actually a lisp. I believe it came in with the express tools thus not being able to find it in the help file.

Posted

And as this was a LISP question you may have wanted to ask it in the "AutoLISP, VBA, the CUI & Customisation" portion of this forum.

Posted

Ya that's where I found the information on the GATTE was in the express help... I didn't know there was a part of the forum dedicated to such questions... I will be sure to place my future LISP questions there... Thanks for the help.

  • 3 years later...
Posted
Gatte isnt a command but it's actually a lisp. I believe it came in with the express tools thus not being able to find it in the help file.

 

does anyone know of a lisp that will change multiple and different blocks at once. the GATTE command will only let me select one block at a time. I have a drawing full of furniture with various text attribute tags on them and i want to change them all to blank.

Posted

If using a lisp you can use wildcards in the block names furn1 furn2 furn* etc or you can search for multiple block names furn1,furn2,furn3.

 

Every one will now say how will that work with different tag names pretty simple you can ignore tags and change a value by its attribute order like line1 line2 etc sane as you would see if you double click a block.

 

This is a bit of code cut from another program under development needs the ssget added can you post block names etc maybe a dwg

 

; attribute change by line no

(vl-load-com)
(setq ss1 (car (entsel "pick block")))
(setq bname (vla-get-name(vlax-ename->vla-object SS1))) 

(SETQ newstrblank ".")
(foreach att (vlax-invoke (vlax-ename->vla-object SS1) 'getattributes)
    (vla-put-textstring att newstrblank)
)

(princ) 

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