Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How do i use a field to display text information from a AutoCAD table?

3 REPLIES 3
Reply
Message 1 of 4
rickgenz
423 Views, 3 Replies

How do i use a field to display text information from a AutoCAD table?

I have a situation where I have a AutoCAD table linked to a Excel table to retrieve lots of general information for a standard drawing. That works just fine. In additionally I can use the fields "formula" field name and select a cell in the AutoCAD table to pull the data from the cell to the field, and this works for table cells that are numeric, but some of the cells are text based, and for these situations AutoCAD simply gives me the #### result. Is there a way to use a field to display text data from a AutoCAD table Cell?

 

 

3 REPLIES 3
Message 2 of 4
Anonymous
in reply to: rickgenz

Someone posted this exact issue in the Civil3D forum, and no solution was found.  By looking into this the only thing I could think of was to do another table and use the range option to bring in only the cell with the text I wanted.

Message 3 of 4
rickgenz
in reply to: Anonymous

Yea, i thought of that too, the propblem with that is i am wanting the information to be part of mtext, and the surrounding text is always of different length, so a inserted field would be required to keep the justification etc.. correct.

 

Thanks for the reply!!

 

If there is no solution, you can bet i am adding it to the Wish list!!

Message 4 of 4
Lee_Mac
in reply to: rickgenz

My first thoughts were to use a field referencing the relevant MText entity representing the cell value in the anonymous block associated with the Table.

 

e.g.:

(defun _TableCellMText ( table cellvalue )
    (
        (lambda ( table / mtext )
            (while (and (not mtext) (setq table (entnext table)))
                (if
                    (and
                        (eq "MTEXT" (cdr (assoc 0 (entget table))))
                        (eq cellvalue (cdr (assoc 1 (entget table))))
                    )
                    (setq mtext table)
                )
            )
            mtext
        )
        (   (lambda ( table )
                (tblobjname "BLOCK" (cdr (assoc 2 (entget table))))
            )
            (if (eq 'VLA-OBJECT (type table))
                (vlax-vla-object->ename table)
                table
            )
        )
    )
)

 

(_TableCellMText <Table Entity> "Cell Value")

 

But creation of a field expression referencing the ObjectID of this entity throws an exception, so now I'm out of ideas, save using a reactor.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost