Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
change an attribute text
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
This has probably been done over and over but I am not undersatanding. I have a block "MANAGER" with Two Attributes "CETOP" and "CEBOT" I would like a lisp to replace what ever is in those attributes with defined text, for my purposes "Text1" and "Text2". I would like a simple routine that even I can understand so I can apply it to a couple of other lisp projects I have.
Re: change an attribute text
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
richie.hodgson wrote:This has probably been done over and over but I am not undersatanding. I have a block "MANAGER" with Two Attributes "CETOP" and "CEBOT" I would like a lisp to replace what ever is in those attributes with defined text, for my purposes "Text1" and "Text2". I would like a simple routine that even I can understand so I can apply it to a couple of other lisp projects I have.
The Vanilla code posted on your other thread is a s simple as it can be richie.
If you want a generic code:
(defun Revall (dat_ bn / att# sset e an ad )
(if (setq sset (ssget "_X" (list '(0 . "INSERT")'(66 . 1) (cons 2 bn))))
(progn
(prompt "\nupdating.......please wait. ")
(while (setq e (ssname sset 0))
(setq an (entnext e)
ad (entget an))
(while (= "ATTRIB" (cdr (assoc 0 ad)))
(if (setq val (assoc (cdr (assoc 2 ad)) dat_))
(setq ad (entmod (subst (cons 1 (cadr val))
)
(setq an (entnext an)
ad (entget an))
)
(ssdel e sset)
)
)
)
(princ)
)
(defun c:CTV (/ bn tag val data) ;Chagne TagString value
(setq bn "MANAGER"
tag '("CETOP" "CEBOT"))
(foreach
tg tag
(setq val (getstring t
(strcat
"\nEnter New String Value for TAG " tg
": ")))
(setq data (cons (list tg val) data)))
(if data
(Revall data bn)
))
You can create as many command name as you please and change the TAG and BN for specific block
(defun c:CTV2 (/ bn tag val data)
(setq bn "AnotherBlockName"
tag '("TAG1" "TAG2 "TAG3"))
.....
)
HTH
Re: change an attribute text
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi, many thanks for that, what I am trying to do is put 2 lines of "pre-set" text in those attributes, (setq txt1 "Line1 text") (setq txt2 "Line 2 Text"), so txt1 goes into CETOP and txt2 goes into CEBOT I can see how your code works but not sure how to do this bit with the way you have coded it.
Re: change an attribute text
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
richie.hodgson wrote:Hi, many thanks for that, what I am trying to do is put 2 lines of "pre-set" text in those attributes, (setq txt1 "Line1 text") (setq txt2 "Line 2 Text"), so txt1 goes into CETOP and txt2 goes into CEBOT I can see how your code works but not sure how to do this bit with the way you have coded it.
(defun c:reman nil
(Revall '(("CETOP" "Line1 text")("CEBOT" "Line 2 text")) "MANAGER")
)
Re: change an attribute text
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
That has made me very happy, will try it out tomorrow when I get some time, Gives me two good methos to approach attribute manipulation
Re: change an attribute text
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Many thanks, it all works beautifully, have made a couple of changes to suit.
Re: change an attribute text
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
richie.hodgson wrote:Many thanks, it all works beautifully, have made a couple of changes to suit.
You're welcome. ![]()
Cheers

