magwea Posted February 5, 2009 Share Posted February 5, 2009 Is there a simple way of doing this out there. Normally its easy enough to just retype, but sometimes, (eg with regards to the justification, height, style, location) its not so easy. Anyone help me out. Quote Link to comment Share on other sites More sharing options...
uddfl Posted February 5, 2009 Share Posted February 5, 2009 Try this LISP routine. Hope it helps. ;Tip1791: TXT2ATTDEF.LSP TEXT TO ATTRIBUTES (c)2002, Sanjay Kulkarni (defun C:TXT2ATTDEF (PCMDECHO TXT1 IFTXT TXT1VAL TXT1IP TXT1HT TXT1ROT APRMPT PAFLAGS) (setq PCMDECHO (getvar "CMDECHO")) (setvar "CMDECHO" 0) (setq TXT1 (entget (car (entsel "\nSelect Text : ")))) (setq IFTXT (cdr (assoc 0 TXT1))) (while (/= IFTXT "TEXT") (setq TXT1 (entget (car (entsel (strcat "\nSelection Error !! You selected " IFTXT "! \nPlease Select Text : " ) ;_ end of strcat ) ;_ end of entsel ) ;_ end of car ) ;_ end of entget ) ;_ end of setq (setq IFTXT (cdr (assoc 0 TXT1))) ) ;_ end of while (setq TXT1VAL (cdr (assoc 1 TXT1))) (setq TXT1IP (cdr (assoc 10 TXT1))) (setq TXT1HT (cdr (assoc 40 TXT1))) (setq TXT1ROT (cdr (assoc 50 TXT1))) (setq APRMPT (getstring T "\nAttribute prompt : ")) (entdel (cdar TXT1)) (setq PAFLAGS (getvar "AFLAGS")) (setvar "AFLAGS" 0) (command "attdef" "" TXT1VAL APRMPT TXT1VAL TXT1IP TXT1HT (/ (* TXT1ROT 180) (/ 22.0 7.0)) ) ;_ end of command (setvar "AFLAGS" PAFLAGS) (setvar "CMDECHO" PCMDECHO) (princ) ) ;defun txt2attdef Source: http://cadtips.cadalyst.com/attributed-blocks/text-attributes Quote Link to comment Share on other sites More sharing options...
magwea Posted February 7, 2009 Author Share Posted February 7, 2009 Thanks uddfl, sorry for not replying sooner, i'll give the lisp a go -never needed to use them before-, although, i'm kind of surprised that there isn't a tool build into Ac to do this already. Quote Link to comment Share on other sites More sharing options...
emhigginson Posted March 23, 2009 Share Posted March 23, 2009 This seems handy, but I get an error "TXT2ATTDEF ; error: too few arguments" when I give it a run. I take it neither one of you did? I've been trying it on a Mtext with multiple fields, so maybe the fields are messing it up... Quote Link to comment Share on other sites More sharing options...
uddfl Posted March 24, 2009 Share Posted March 24, 2009 I get an error "TXT2ATTDEF ; error: too few arguments" when I give it a run. I've been trying it on a Mtext with multiple fields It only works with one-line TEXT, not MTEXT. Quote Link to comment Share on other sites More sharing options...
NAILER20 Posted May 27, 2009 Share Posted May 27, 2009 Help I am fianaly sorting out my block libary I have fuse holder blocks that have attributes associated with them docked on a tool pallett. My question is: can attributes be defined as Mtext so that justification can be applied ? the various names of the fuse holder varies in length and often the justification is way off when I fill in the attributes thanks all Quote Link to comment Share on other sites More sharing options...
rkent Posted May 27, 2009 Share Posted May 27, 2009 Help I am fianaly sorting out my block libary I have fuse holder blocks that have attributes associated with them docked on a tool pallett. My question is: can attributes be defined as Mtext so that justification can be applied ? the various names of the fuse holder varies in length and often the justification is way off when I fill in the attributesthanks all Attributes can be assigned any of the text justifications. And in 2009 and 2010 you can specify multiple lines. Quote Link to comment Share on other sites More sharing options...
NAILER20 Posted May 27, 2009 Share Posted May 27, 2009 thanks rkent I spent some time and arrived at the same conclusion, since I posted my help. My company has no plans to upgrade to 2009/2010 so I'll have to keep shoving sqare pegs into round holes but thank you again Quote Link to comment Share on other sites More sharing options...
Ryder76 Posted May 27, 2009 Share Posted May 27, 2009 NAILER20 Try BATTMAN you can select a block and globally change the properties of the attributes. Don't forget to sync the block. Quote Link to comment Share on other sites More sharing options...
lanasharp Posted November 10, 2015 Share Posted November 10, 2015 This is the error I get, any clues? AutoCAD 2013, thx! Command: TXT2ATTD Select A TEXT to Convert to ATTDEF: ; error: bad argument type: lselsetp nil Try this LISP routine. Hope it helps. ;Tip1791: TXT2ATTDEF.LSP TEXT TO ATTRIBUTES (c)2002, Sanjay Kulkarni (defun C:TXT2ATTDEF (PCMDECHO TXT1 IFTXT TXT1VAL TXT1IP TXT1HT TXT1ROT APRMPT PAFLAGS) (setq PCMDECHO (getvar "CMDECHO")) (setvar "CMDECHO" 0) (setq TXT1 (entget (car (entsel "\nSelect Text : ")))) (setq IFTXT (cdr (assoc 0 TXT1))) (while (/= IFTXT "TEXT") (setq TXT1 (entget (car (entsel (strcat "\nSelection Error !! You selected " IFTXT "! \nPlease Select Text : " ) ;_ end of strcat ) ;_ end of entsel ) ;_ end of car ) ;_ end of entget ) ;_ end of setq (setq IFTXT (cdr (assoc 0 TXT1))) ) ;_ end of while (setq TXT1VAL (cdr (assoc 1 TXT1))) (setq TXT1IP (cdr (assoc 10 TXT1))) (setq TXT1HT (cdr (assoc 40 TXT1))) (setq TXT1ROT (cdr (assoc 50 TXT1))) (setq APRMPT (getstring T "\nAttribute prompt : ")) (entdel (cdar TXT1)) (setq PAFLAGS (getvar "AFLAGS")) (setvar "AFLAGS" 0) (command "attdef" "" TXT1VAL APRMPT TXT1VAL TXT1IP TXT1HT (/ (* TXT1ROT 180) (/ 22.0 7.0)) ) ;_ end of command (setvar "AFLAGS" PAFLAGS) (setvar "CMDECHO" PCMDECHO) (princ) ) ;defun txt2attdef Source: http://cadtips.cadalyst.com/attributed-blocks/text-attributes Quote Link to comment Share on other sites More sharing options...
ReMark Posted November 12, 2015 Share Posted November 12, 2015 Two solutions to your problem were included in the thread you first posted to (re: your question about updates to AutoCAD 2013). See post #7 by David Bethel and post #8 by Lee Mac. Both forum members are known for the quality of their lisp routines. http://www.cadtutor.net/forum/showthread.php?28205-Text-2-Attribute Did you ever figure out whether or not you had the last service pack for 2013 installed? Quote Link to comment Share on other sites More sharing options...
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.