+ Reply to Thread
Results 1 to 9 of 9
  1. #1
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Jan 2009
    Posts
    23

    Default Can I change Mtext or Dtext into a Defined Attribute?

    Registered forum members do not see this ad.

    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.

  2. #2
    Senior Member uddfl's Avatar
    Using
    AutoCAD 2008
    Join Date
    Oct 2008
    Posts
    312

    Default

    Try this LISP routine. Hope it helps.

    Code:
    ;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/attribut...ext-attributes
    "AS IS" AND WITH ALL FAULTS.

  3. #3
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Jan 2009
    Posts
    23

    Default

    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.

  4. #4
    Junior Member
    Using
    AutoCAD 2008
    Join Date
    Feb 2008
    Posts
    11

    Default

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

  5. #5
    Senior Member uddfl's Avatar
    Using
    AutoCAD 2008
    Join Date
    Oct 2008
    Posts
    312

    Default

    Quote Originally Posted by emhigginson View Post
    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.
    "AS IS" AND WITH ALL FAULTS.

  6. #6
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Oct 2008
    Posts
    12

    Default

    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

  7. #7
    Forum Deity rkent's Avatar
    Computer Details
    rkent's Computer Details
    Operating System:
    WIN7 PRO 64bit
    Computer:
    Dell Precision T7500
    CPU:
    Xeon Dual Core E5503 2.0Ghz
    RAM:
    6GB DDR3 ECC SDRAM, 1333MHz, 6x1GB
    Graphics:
    nVidia Quadro 3800
    Primary Storage:
    300Gb, 10K rpm
    Monitor:
    Dell 24" FS (2x)
    Discipline
    Mechanical
    rkent's Discipline Details
    Occupation
    Facilities Design - Semi-conductor manufacturing
    Discipline
    Mechanical
    Details
    Designer: Process Piping, P&ID's, Machine Part Design, Planning / General Arrangement. Facilities Management. Drafting: Electrical, Controls, Architectural.
    Using
    Mechanical 2014
    Join Date
    Nov 2007
    Location
    Lat:35, Long:-106, Elev: 5164'
    Posts
    3,375

    Default

    Quote Originally Posted by NAILER20 View Post
    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
    Attributes can be assigned any of the text justifications. And in 2009 and 2010 you can specify multiple lines.
    "You are entitled to your own opinion but you are not entitled to your own facts." Daniel Patrick Moynihan

  8. #8
    Junior Member
    Using
    AutoCAD 2007
    Join Date
    Oct 2008
    Posts
    12

    Default

    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

  9. #9
    Super Member Ryder76's Avatar
    Computer Details
    Ryder76's Computer Details
    Operating System:
    Windows 7
    Computer:
    Dell T7500
    Discipline
    See details...
    Ryder76's Discipline Details
    Occupation
    Electrical Designer - Oil & Gas
    Discipline
    See details below.
    Details
    Subsea Solutions
    Using
    AutoCAD 2010
    Join Date
    May 2009
    Location
    Houston, Texas
    Posts
    570

    Default

    Registered forum members do not see this ad.

    NAILER20

    Try BATTMAN you can select a block and globally change the properties of the attributes. Don't forget to sync the block.

Similar Threads

  1. Is it possible to change the width factor wth MTEXT
    By Andy G in forum AutoCAD General
    Replies: 7
    Last Post: 4th Feb 2010, 04:04 pm
  2. Routine to change entities to defined layers
    By Tredouce in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 30th Jul 2008, 08:27 pm
  3. Change Padding(Randversatz) of MText
    By Gloem in forum AutoLISP, Visual LISP & DCL
    Replies: 4
    Last Post: 25th Feb 2008, 01:59 pm
  4. Is it possible to convert DText to MText universally
    By TateCE in forum AutoCAD Drawing Management & Output
    Replies: 3
    Last Post: 16th Dec 2005, 02:44 pm
  5. dtext to mtext
    By XAVIER in forum AutoCAD Drawing Management & Output
    Replies: 2
    Last Post: 3rd Oct 2003, 09:53 pm

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts