• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Visual LISP, AutoLISP and General Customization

    Reply
    New Member
    Posts: 2
    Registered: ‎12-13-2012

    Re: Convert Field to Text

    12-13-2012 05:24 PM in reply to: Ian_Bryant

    This is an old post, so I hope Ian (or someone else can help) I am looking to remove FIELD definitions from MTEXT within a TABLE... similar to the code listed above (as all the above works with DIMS, TEXT, MTEXT, ATTRIBUTES, but not TABLES. :-(

     

    Thanks in advance. - Tracy Lincoln (yes, the one and only)

    Please use plain text.
    Valued Mentor
    Posts: 362
    Registered: ‎06-02-2005

    Re: Convert Field to Text

    12-14-2012 04:09 AM in reply to: twlincoln2009

    Hi,
    not well tested,
    and will not change tables on locked layers,
    or change locked table cells.

    Create a selection set of the table entities
    and step through it applying the following function
    to each ename in the set.

    (defun do_table (ent / obj nr nc nc1 nr1 vv tstring)
     (setq obj (vlax-ename->vla-object ent)
           nr (vlax-get obj 'Rows)
           nc (vlax-get obj 'Columns)
     )
     (setq nr1 0)
     (while (< nr1 nr)
       (setq nc1 0)
       (while (< nc1 nc)
         (if (and
                (= (vla-GetCellType obj nr1 nc1) 1)
                (setq tstring (vla-gettext obj nr1 nc1))
             )
             (progn
              (vl-catch-all-apply 'vla-deletecellcontent
                     (list obj nr1 nc1)
              )
              (setq vv (vla-getcellvalue obj nr1 nc1))
              (vl-catch-all-apply 'vla-SetTextString
                     (list obj nr1 nc1 vv tstring)
              )
             )
         )
         (setq nc1 (+ 1 nc1))
       )
       (setq nr1 (+ 1 nr1))
     )
     (princ)
    )
    Ian

    Please use plain text.
    New Member
    Posts: 2
    Registered: ‎12-13-2012

    Re: Convert Field to Text

    01-16-2013 12:17 PM in reply to: Ian_Bryant

    Thank you for the code, but I cannot seem to get it to work after I load it?

     

    Please use plain text.