Link fields to table cells

Link fields to table cells

farzanbayat74
Advocate Advocate
5,897 Views
18 Replies
Message 1 of 19

Link fields to table cells

farzanbayat74
Advocate
Advocate

Hi

How can I link a field to a table cell content?

Accepted solutions (1)
5,898 Views
18 Replies
Replies (18)
Message 2 of 19

paullimapa
Mentor
Mentor
Message 3 of 19

paullimapa
Mentor
Mentor

paulli_apa_0-1681604044765.png

 

 


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
Message 4 of 19

farzanbayat74
Advocate
Advocate

Hi @paullimapa , thanks for your response.

I want to have a field outside the table and this field shows the value of table cell.

Message 5 of 19

paullimapa
Mentor
Mentor

then you'll need this add-on which is not free:

How to link / insert a table cell to AutoCAD fields. - YouTube


Paul Li
IT Specialist
@The Office
Apps & Publications | Video Demos
0 Likes
Message 6 of 19

TerryDotson
Mentor
Mentor
Accepted solution

How can I link a field to a table cell content?

Assuming your table cell content is numeric:

 

  1. Initiate the FIELD command.
  2. Field Category: All
  3. Field Names: Formula
  4. Click [Cell] button.
  5. Click [OK] to begin placement.

AutoCAD fields prevent this from working on non-numeric content.  Some might call it a design limitation; some call it a very mature bug.

Message 7 of 19

dbroad
Mentor
Mentor

If you're willing to use a LISP command, this might work for you.

;;Basic demonstration of linking a table cell to a field
;;No error checking, no guarantees. Seems to work. Creates a text object.
;;D. C. Broad, Jr.  4/17/2023
(defun c:fieldcell (/ textent textobj oid)
  (if
    (and
      (setq textent (car (nentsel "\nSelect table cell")))
      (setq textobj (vlax-ename->vla-object textent))
      (setq oid (vla-get-objectid textobj))
    )
     (command "_.text"
	      pause
	      ""
	      ""
	      (strcat "%<\\AcObjProp Object(%<\\_ObjId "
		      (itoa oid)
		      ">%).TextString>%"
	      )
	      ""
     )
  )
  (princ)
)
Architect, Registered NC, VA, SC, & GA.
Message 8 of 19

ChicagoLooper
Mentor
Mentor

@farzanbayat74 wrote

<<...I want to have a field outside the table and this field shows the value of table cell....>>

 

Use MTEXT to display the value of the cell.

 

Start mtext command=>>Right-click=>>Insert Field=>>then do this:

1001.png

Chicagolooper

EESignature

Message 9 of 19

TerryDotson
Mentor
Mentor

If you're willing to use a LISP command, this might work for you.

 

(nentsel "\nSelect table cell")

 

 

This portion does not appear to work when the cell font is truetype, unless the drawings VisualStyle is set to "Realistic".  Cells using SHX fonts always seem to work.

 

Found the same problem in the .NET GetEntity, GetNestedEntity.

Message 10 of 19

dbroad
Mentor
Mentor

That seems about right with AutoCAD. It's always something.  Just when you think it works right, it doesn't.

Architect, Registered NC, VA, SC, & GA.
Message 11 of 19

dbroad
Mentor
Mentor

So some eager beaver could add on by  1)Using hittest to determine which row and column is selected, 2)Get the celltextstyle for that cell, 3)determine whether that style is SHX 4)if so, do fieldcell, 5)otherwise create a temporary text style with an shx font, 6)temporary set the celltextstyle for that cell, 7)do the function fieldcell actions, 8)set the celltextstyle back to whatever it was, 9)delete the temporary text style.

Architect, Registered NC, VA, SC, & GA.
0 Likes
Message 12 of 19

TerryDotson
Mentor
Mentor

So some eager beaver could add on by  ....

I had a different train of thought, added an option to our ToolPac Table SubSelection tools so the user can simply swipe across the cells they want to create linked mtext from and click a button.  It instantly creates all the fields in the current layer so the user can then simply drag them to the desired locations.

 

Capture1.png

 

Could be used in combination with a linked table from Excel, etc.

Message 13 of 19

farzanbayat74
Advocate
Advocate

Thanks @TerryDotson , It worked. easy and no need for lisps 👍

0 Likes
Message 14 of 19

olov_backlund
Observer
Observer

Hi,
Is it possible to get the cell's value without what is before the cell's value?

{\fAptos Narrow|b0|i0|c0;2024-05-29

Would like it to look like this: 2024-05-29

Thanks in advance!
Olov

0 Likes
Message 15 of 19

cadffm
Consultant
Consultant

@olov_backlund  schrieb:

the cell's value without what is before the cell's value?


Hi,

 

don't use internal Mtext formattings (your sample: Overrided Font for example)

but yes, it is also possible to by a change of your fieldcode:

cadffm_0-1716978011780.png

HTH

Sebastian

0 Likes
Message 16 of 19

olov_backlund
Observer
Observer

Hi,

Thanks for the help. Is it possible to force the cell value to be in uppercase?

/Olov

0 Likes
Message 17 of 19

cadffm
Consultant
Consultant

cadffm_0-1716981540207.png

 

 

 

 

 
 

 

 

Sebastian

0 Likes
Message 18 of 19

HuynhMinhTri
Community Visitor
Community Visitor

But it can link cell value to text

0 Likes
Message 19 of 19

olov_backlund
Observer
Observer

Hi,

It is possible to merge two or more cell values with a space between them?

And is it possible to add these fields to a block?

 

/Olov

0 Likes