Field Code to link to AutoCAD Table Cell

Field Code to link to AutoCAD Table Cell

alan_rackham
Enthusiast Enthusiast
2,225 Views
7 Replies
Message 1 of 8

Field Code to link to AutoCAD Table Cell

alan_rackham
Enthusiast
Enthusiast

Hi

 

Is there any way of writing a field code that will link to a cell?  I have managed to do this using the formula cell option, however, this will only display numbers, but not text.  Does anyone have another way of doing this?

 

Thanks,

0 Likes
2,226 Views
7 Replies
Replies (7)
Message 2 of 8

fatal.error
Advocate
Advocate

It's not possible to get table cell text contents. Formula fields works only with numbers.

There are some third party paid apps out there.

 

As a workaround, how about linking content on the opposite way:

 

1. Create a Mtext with some dummy text content.

2. Insert a Field nested inside cell table.

3. Double-click the previous Field.

4. In "Field names" select "Object".

5. Click the "Select object" button and select the dummy Mtext.

6. Select the "Content" property and hit OK.

0 Likes
Message 3 of 8

alan_rackham
Enthusiast
Enthusiast

Thanks, fatal.error

 

My data is coming from Excel.  So working the other way does not work for me

 

Thanks,

Alan

Message 4 of 8

alan_rackham
Enthusiast
Enthusiast

fatal.error

 

This is still a problem not sure why you are congratulating me 🙂

 

Alan

0 Likes
Message 5 of 8

ChicagoLooper
Mentor
Mentor

You are correct. You can only do it for numbers using a formula. Text strings are not supported.

Chicagolooper

EESignature

0 Likes
Message 6 of 8

alan_rackham
Enthusiast
Enthusiast

Hi

 

I am now thinking if I can get the table into a lisp list I can access this with field codes.  I found this:-

 

;:Ranjit Singh
;;8/3/17
(defun c:somefunc  (/ c ctr dat etdata ind lst prefix r tab tblent tblobj val varname)
 (setq etdata (entget (setq tblent (car (entsel "\nSelect table object: "))))
       ind    (cdr (assoc 91 etdata))
       tab    (cdr (assoc 92 etdata))
       r      0
       c      0
       ctr    1
       prefix "var"
       tblobj (vlax-ename->vla-object tblent))
 (while (< c tab)
  (while (< r ind)
   (set (setq varname (read (strcat prefix (itoa ctr))))
        (progn (setq val (vlax-invoke tblobj 'getcellvalue r c)
                     val (if (= 'str (type val))
                          (substr val (- (1+ (strlen val)) (vl-position (ascii ";") (reverse (vl-string->list val)))))
                          val))))
   (setq lst (cons (setq dat (cons varname val)) lst))
   (setq ctr (if (listp (cdr dat))
              ctr
              (1+ ctr))
         r   (1+ r)))
  (setq r 0
        c (1+ c)))
 (vl-remove-if '(lambda (x) (listp (cdr x))) (reverse lst)))

This helps however I want to modify this lisp to just give me the values and change the "VAL1" to "A1" etc. Can anyone help?
0 Likes
Message 7 of 8

ChicagoLooper
Mentor
Mentor

Vanilla Cad objects are 'dumb' and what you need are 'smart' objects. Think of an old flip phone where a text required you to press the 3-key three times for F, the 4-key twice for H, etc., etc. Those phones were dumb. Now phones have keyboards, gps, cameras and internet access. They're smart.

 

You might be able to send a text on an old phone just as fast as using a new phone if you practice pressing keys really fast. But no matter how fast you press, it's still a dumb phone. If you're serious and want to use smart objects, i.e. object data and databases, you'll need to level up.

Chicagolooper

EESignature

0 Likes
Message 8 of 8

alan_rackham
Enthusiast
Enthusiast

ChacagoLooper

 

Not sure what you are trying to get at here or how it helps?

 

Alan