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

Compare 2 Cells in a Table

7 REPLIES 7
Reply
Message 1 of 8
SteveKemp
348 Views, 7 Replies

Compare 2 Cells in a Table

Is there any way to compare 2 cells in a table? I have tried diesel

 

$(if,$(EQ,%<\AcObjProp Object(%<\_ObjId 2128896328>%).b2>%,%<\AcObjProp Object(%<\_ObjId 2128896328>%).d2>%),true,false)

 

I can't seem to pass the cells into the equation. I tried formulas also with no luck.

 

Thanks in advance

Steve in Alaska

7 REPLIES 7
Message 2 of 8
_Tharwat
in reply to: SteveKemp

Read about the following function from Acad Help Documentation .

vla-gettext

 Tharwat

Message 3 of 8
SteveKemp
in reply to: _Tharwat

 

Thank you for your quick reply, I did look for "vla-gettext" in the help file of my AutoCAD, and I even looked in the AutoCAD Developer Help file. There isn't any reference to "vla-gettext".

 

I am using AutoCAD 2010.

 

I did a quick Google for "vla-gettext" and found a couple of program snips, but no real reference to "vla-gettext".

 

It would help I suppose if I had some reference to how you propose to use "vla-gettext", do you think I can enter this term into a field in a cell?

 

I am trying to find a way to compare the values of 2 cells, and if the cell values are not the same display an "x" . As I said in my original post, I have tried formulas and diesel and have been unsuccessful.

 

Steve in Alaska

Message 4 of 8
_Tharwat
in reply to: SteveKemp

Since you are using Autocad 2010 you do the following to get more information about the function that I posted earlier .

 

Type in commnad line Vlide  to invoke the Autolisp App. and then type the function and you would realize the it turned into blue color and after that highlight the function and press on the Help button that existed in the toolbar .

 

The return of the function would be a string and whatever if the background of the string is field or a text , so you would check if the string is equal to another and nothings more ( up to my knowledge)

 

Just ask if you need any help .

 

Tharwat

Message 5 of 8
_Tharwat
in reply to: SteveKemp

simple example ...

 

(defun c:test (/ table val1 val2)
  (vl-load-com)
  (if (and (setq table (car (entsel "\n Select table :")))
         (eq (cdr (assoc 0 (entget table))) "ACAD_TABLE")
         )
  (progn
    (setq table (vlax-ename->vla-object table))
    (setq val1 (vla-gettext table 1 0));; row number 2 and column 1 (which means that 
;;; first row or column is equal to zero) (setq val2 (vla-gettext table 1 1));; row number 2 and column 2 (if (eq val1 val2) (alert "\n That's correct") (alert "\n That's wrong ") ) ) ) (princ) )

 

Message 6 of 8
SteveKemp
in reply to: _Tharwat

Thank you again

 

I have not yet given up hope to have this contained all in the table. My next choice would be to attach a reactor to the table. My last choice to accomplish what I am trying to do is to write a lisp that requires running to update the table.

 

Steve in Alaska

Message 7 of 8
_Tharwat
in reply to: SteveKemp

Why you are everytime changing your opinion and  talking about something else ???

 

Did my code answer your first question or not ?

Message 8 of 8
SteveKemp
in reply to: _Tharwat

 

Your right, I did not present my need completely and thoroughly. You have presented a solution based on the original post. If you had been a wizard you would have seen that by presenting a diesel expression, that I was trying to create a self contained solution.

 

Thank you very much for your help, I do appreciate it.

 

Steve in Alaska

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

Post to forums  

Autodesk Design & Make Report

”Boost