Size of Table Entity

Size of Table Entity

kpennell
Collaborator Collaborator
431 Views
3 Replies
Message 1 of 4

Size of Table Entity

kpennell
Collaborator
Collaborator

I'm retreiving a table entity:

 

(setq TableEntity (car (entsel "\nSelect Table:")))

(setq TableData (entget TableEntity))

 

and all of this wonderful data.  My point of interest is:

 

(141 . 4.66667)
(141 . 5.04762)
(141 . 4.66667)
(142 . 6.98857)
(142 . 19.3457)
(142 . 20.0)

 

which are the table row heights and column widths.  The number of rows and widths will vary, and so will the row heights and column widths, per table per drawing.

 

How can I manipulate the lists to add all of the "141" values to get the true table height, and all of the "142" values to get the true table width?

0 Likes
Accepted solutions (1)
432 Views
3 Replies
Replies (3)
Message 2 of 4

hmsilva
Mentor
Mentor
Accepted solution

@kpennell wrote:

I'm retreiving a table entity:

 

(setq TableEntity (car (entsel "\nSelect Table:")))

(setq TableData (entget TableEntity))

 

and all of this wonderful data.  My point of interest is:

 

(141 . 4.66667)
(141 . 5.04762)
(141 . 4.66667)
(142 . 6.98857)
(142 . 19.3457)
(142 . 20.0)

 

which are the table row heights and column widths.  The number of rows and widths will vary, and so will the row heights and column widths, per table per drawing.

 

How can I manipulate the lists to add all of the "141" values to get the true table height, and all of the "142" values to get the true table width?


(setq TableWidth (apply '+ (mapcar '(lambda (x) (cdr x)) (vl-remove-if-not '(lambda (x) (= (car x) 142)) TableData)))
      TableHeight (apply '+ (mapcar '(lambda (x) (cdr x)) (vl-remove-if-not '(lambda (x) (= (car x) 141)) TableData))))

 

 

Espero que ajude
Henrique

EESignature

0 Likes
Message 3 of 4

kpennell
Collaborator
Collaborator

You got it.

 

Thanks

0 Likes
Message 4 of 4

hmsilva
Mentor
Mentor

@kpennell wrote:

You got it.

 

Thanks


You're welcome!
Glad I could help

Henrique

EESignature

0 Likes