Visual LISP, AutoLISP and General Customization

Reply
Member
twlincoln2009
Posts: 3
Registered: ‎12-13-2012
Message 21 of 23 (373 Views)

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)

Valued Mentor
Ian_Bryant
Posts: 362
Registered: ‎06-02-2005
Message 22 of 23 (353 Views)

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

Member
twlincoln2009
Posts: 3
Registered: ‎12-13-2012
Message 23 of 23 (271 Views)

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?

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community