Results 1 to 3 of 3

Thread: Mtext In Attributes

  1. #1
    I could stop if I wanted to
    Join Date
    2015-09
    Posts
    420
    Login to Give a bone
    0

    Default Mtext In Attributes

    Hello AUGI Members:

    Is there a way to use Mtext in a Attribute tag definition....??....I have a block with attributes and from time to time one or more of the attributes requires 2 lines of text. At the moment the block I have can only accommodate a single line attribute.

    I was hoping that Mtext could be used with a specified width so that when the length of the string exceeds the defined width the string would jump to 2 lines automatically.

    Any assistance would be appreciated......!

    Regards,
    Vince

  2. #2
    Administrator Opie's Avatar
    Join Date
    2002-01
    Location
    jUSt Here (a lot)
    Posts
    9,096
    Login to Give a bone
    0

    Default Re: Mtext In Attributes

    Not currently. Have you thought about submitting a wish?
    If you have a technical question, please find the appropriate forum and ask it there.
    You will get a quicker response from your fellow AUGI members than if you sent it to me via a PM or email.
    jUSt

  3. #3
    Login to Give a bone
    0

    Default Re: Mtext In Attributes

    I have been searching for a routine similar to this post about how to get a block attribute mtext value and also how to change it's value.
    Please review the attached LISP routines GetEntNameAttrib.lsp and PutEntNameAttrib.lsp.
    Both of these only work for the traditional text attributes, but not for mtext attributes for blocks.
    I would appreciate your help or leads to where I can find out how to modify my routines to work with mtext attributes.
    Thanks
    Code:
    ;-------------------------------------------------------------------------------
    ; GetEntNameAttrib - Get Entity name Attribute value
    ; Arguments: 2
    ;   EntityName^ = Entity name
    ;   AttrTag$ = Tag label of attribute
    ; Returns: Attribute value
    ;-------------------------------------------------------------------------------
    (defun GetEntNameAttrib (EntityName^ AttrTag$ / AttrVal$ EntAttr$ EntList@ EntName^ EntTag$ EntType$)
      (if (= (type EntityName^) 'ENAME)
        (progn
          (setq EntName^ EntityName^
                EntList@ (entget EntName^)
                EntType$ (cdr (assoc 0 EntList@))
          );setq
          (if (and (= EntType$ "INSERT") (assoc 66 EntList@))
            (while (/= (cdr (assoc 0 EntList@)) "SEQEND")
              (setq EntList@ (entget EntName^)
                    EntType$ (cdr (assoc 0 EntList@))
                    EntAttr$ (cdr (assoc 1 EntList@))
                    EntTag$  (cdr (assoc 2 EntList@))
              );setq
              (if (= EntType$ "ATTRIB")
                (if (= EntTag$ (strcase AttrTag$))
                  (setq AttrVal$ EntAttr$)
                );if
              );if
              (setq EntName^ (entnext EntName^))
            );while
          );if
        );progn
      );if
      AttrVal$
    );defun GetEntNameAttrib
    ;-------------------------------------------------------------------------------
    ; PutEntNameAttrib - Put Entity name Attribute value
    ; Arguments: 3
    ;   EntityName^ = Entity name
    ;   AttrTag$ = Tag label of attribute
    ;   AttrVal$ = New value for attribute
    ; Returns: Changes attribute value
    ;-------------------------------------------------------------------------------
    (defun PutEntNameAttrib (EntityName^ AttrTag$ AttrVal$ / EntList@ EntName^ EntTag$ EntType$ First)
      (if (= (type EntityName^) 'ENAME)
        (progn
          (setq EntName^ EntityName^
                EntList@ (entget EntName^)
                EntType$ (cdr (assoc 0 EntList@))
                First t
          );setq
          (if (and (= EntType$ "INSERT") (assoc 66 EntList@))
            (while (/= (cdr (assoc 0 EntList@)) "SEQEND")
              (setq EntList@ (entget EntName^)
                    EntType$ (cdr (assoc 0 EntList@))
                    EntTag$  (cdr (assoc 2 EntList@))
              );setq
              (if (= EntType$ "ATTRIB")
                (if (and (= EntTag$ (strcase AttrTag$)) First)
                  (progn
                    (entmod (subst (cons 1 AttrVal$) (assoc 1 EntList@) EntList@))
                    (entupd EntName^)
                    (setq First nil)
                  );progn
                );if
              );if
              (setq EntName^ (entnext EntName^))
            );while
          );if
        );progn
      );if
      (princ)
    );defun PutEntNameAttrib
    ;-------------------------------------------------------------------------------
    Last edited by Ed Jobe; 2019-06-24 at 09:28 PM. Reason: Added CODE tags

Similar Threads

  1. Mtext Attributes
    By steve.poplaski in forum AutoCAD General
    Replies: 4
    Last Post: 2009-08-04, 09:28 PM
  2. Replies: 1
    Last Post: 2009-05-06, 06:40 PM
  3. Add attributes or dynamic lookups to MTEXT
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2007-06-23, 12:14 PM
  4. Replies: 21
    Last Post: 2007-03-20, 02:03 PM
  5. Replies: 3
    Last Post: 2006-10-31, 05:46 PM

Posting Permissions

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