TABLE FUNCTION

TABLE FUNCTION

grobnik
Collaborator Collaborator
394 Views
5 Replies
Message 1 of 6

TABLE FUNCTION

grobnik
Collaborator
Collaborator

Hi to everybody,

I'm asking a question to this forum about table function.

I'm searching a function like EXCEL IF, I mean:

- I have a table with 3 cells, the first contain a calculation value (numeric), the second contain a comparison value, in the third should contain a word "TRUE" or "FALSE" if calculated value is greater or lower than comparison value.

Is there a standard autocad function able to do this ?

I have a lot of drawings containg data.

0 Likes
395 Views
5 Replies
Replies (5)
Message 2 of 6

devitg
Advisor
Advisor

@grobnik Please upload your sample.dwg 

0 Likes
Message 3 of 6

calderg1000
Mentor
Mentor

Regards @grobnik 

Try this code, Read the table data from row number 2.

 

 

;;;___
(defun c:Val_Tab (/ table nrows vals row column tx1 tx2)
  (setq
    table (vlax-ename->vla-object (car (entsel)))
    nrows (vlax-get-property table 'rows)
    row	  1
  )
  (repeat (1- nrows)
    (setq column 0
	  tx1	 (vlax-invoke-method table 'GetText row column)
	  tx2	 (vlax-invoke-method table 'GetText row (1+ column))
    )
    (if	(> (atof tx1) (atof tx2))
  	    (vla-settext table row (+ 2 column) "TRUE")
        (vla-settext table row (+ 2 column) "FALSE")
    (setq row (1+ row))
  )
  (princ)
)

 

 

,  


Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

0 Likes
Message 4 of 6

Sea-Haven
Mentor
Mentor

As the If is only a true or false no need for progn, (if (>, like me thinking to far ahead some times.

 

0 Likes
Message 5 of 6

calderg1000
Mentor
Mentor
It's true, he corrected himself. Thank you so much

Carlos Calderon G
EESignature
>Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

0 Likes
Message 6 of 6

Sea-Haven
Mentor
Mentor

OOps

 

 

 

(if	(> (atof tx1) (atof tx2))
  	    (vla-settext table row (+ 2 column) "TRUE")
        (vla-settext table row (+ 2 column) "FALSE")
    (setq row (1+ row))
  )
should be 
(if  (> (atof tx1) (atof tx2))
  (vla-settext table row (+ 2 column) "TRUE")
  (vla-settext table row (+ 2 column) "FALSE")
)
    (setq row (1+ row))
)

 

 

0 Likes