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 attribute width
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hello,
I found this routine (http://www.cadtutor.net/forum/showthread.php?47667
Could someone modify this lisp that I receive a prompt to choose if the width attribute will be change just in the selected block or in all instances of the block? In that way, I would not have to use the ATTSYNC command each time.
Thanks for any help.
Solved! Go to Solution.
Re: Change attribute width
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
msarqui wrote:
I receive a prompt to choose if the width attribute will be change just in the selected block or in all instances of the block? In that way, I would not have to use the ATTSYNC command each time.
Thanks for any help.
Not sure but, If you do use ATTSYNC anytime within the session, all changes you made on the selected blocks via the routine posted above will revert back to the original.
Does the same thing happens on your end?
Re: Change attribute width
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
You have reason pbjese. I did not make myself clear. I'll explain what I need. This is a procedure that I do in all my projects:
During the process to make my projects, I need to change the width of some attributes with the "Enhanced Attribute Editor." After that, I copy this block several times in the project.
Once the project is finished and built, I need to do the "as built". For this, I edit the block and erase some other attributes. Finally, I use ATTSYNC to update the instances of the block.
The problem is: after use the ATTSYNC, the change that I did in the width of the attribute with the "Enhanced Attribute Editor" is lost.
Because of that, I need a routine that allows me to change the width of an attribute in all instances of the block.
Anyway, it would be nice if the routine could also give me the option to choose if I want to make the width change in just one or in all instances of the block.
I hope I have been more clear now. ![]()
Thanks!
Re: Change attribute width
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
msarqui wrote:......
Because of that, I need a routine that allows me to change the width of an attribute in all instances of the block.
Anyway, it would be nice if the routine could also give me the option to choose if I want to make the width change in just one or in all instances of the block.
I hope I have been more clear now.
Thanks!
Sure it can be done. With the option to globally change the width of the selected ATTDEF. would you want that to be permanent and not even ATTSYNC can do anything about it? <unless redefining the block from an external block>
but its going to have to wait until tomorow its quiting time. ![]()
cheers
Re: Change attribute width
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
pbjse wrote...
would you want that to be permanent and not even ATTSYNC can do anything about it? <unless redefining the block from an external block>
I'm not sure if I understood what you said about it but, I think the answer is yes. I want a permanent change, unless redefining the block from a external block and unless I use the routine again in the same atribute.
And don't be rush, take your time.
Thanks.
Re: Change attribute width
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
msarqui wrote:
I'm not sure if I understood what you said about it but, I think the answer is yes. I want a permanent change, unless redefining the block from a external block and unless I use the routine again in the same atribute.
Thanks.
(defun c:widedit (/ aDoc x attent uwd option tag blk bn)
;;; pBe 11JN2013 ;;;
(vl-load-com)
(setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
(if (and (setq x (car (nentsel "\nSelect attribute: ")))
(eq "ATTRIB" (cdr (assoc 0 (entget x))))
(setq attent (vlax-ename->vla-object x))
(princ (strcat "\nCurrent Width is <" (rtos (vla-get-scalefactor attent) 2)"> "))
(setq uwd (getreal "\nEnter new width: ")))
(progn
(initget "Y N")
(setq option (cond
((getkword "\nApply width to all Attribute of the same block? [Yes/no] <N>: "))
( "N" )))
(if (eq option "N")
(vla-put-scalefactor attent uwd)
(progn
(setq tag (vla-get-tagstring attent))
(setq Blk (vla-ObjectIdToObject aDoc
(vla-get-OwnerId attent))
Bn (vla-get-effectivename blk))
(vlax-for itm (vla-item (vla-get-blocks aDoc) bn)
(if (and (eq (vla-get-objectname itm) "AcDbAttributeDefinition")
(eq (vla-get-tagstring itm) tag))
(vla-put-scalefactor itm uwd)))
(vlax-for layout (vla-get-layouts aDoc)
(vlax-for i (vla-get-block layout)
(if (and
(eq (vla-get-objectname i) "AcDbBlockReference")
(eq (Vla-get-hasAttributes i) :Vlax-true)
(eq (vla-get-effectivename i) bn)
)
(foreach itm (vlax-invoke i 'GetAttributes)
(if (eq (vla-get-tagstring itm) tag)
(vla-put-scalefactor itm uwd))
)
)
)
)
)
)
)
(vl-some
'(lambda (j) (if (null (eval (car j))) (princ (cadr j))
))
'((x "\n<<None Selected>>")
(attent "\n<<Selected object not an Attribute>>")
(uwd "\n<<No Width value>>"))
)
)
(princ)
)
Of course , once you decide NOT to apply new width globally, all "fudge" width will revert back to the original when ATTSYNC is invoke.
USAGE:
Command: WIDEDIT
Select attribute:
Current Width is <1.0000>
Enter new width: 2
Apply width to all Attribute of the same block? [Yes/no] <N>:
Default is "No" , only on selected object.
HTH
Re: Change attribute width
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Dude, the routine is perfect. That was exactly what I needed. Thanks for your work and for being always helpful.
Thank you very much!
Re: Change attribute width
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
msarqui wrote:Dude, the routine is perfect. That was exactly what I needed. Thanks for your work and for being always helpful.
Thank you very much!
You are welcome msarqui ![]()
Happy to help
Cheers

