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

Get a Table Cell's Content Name

6 REPLIES 6
Reply
Message 1 of 7
Anonymous
1251 Views, 6 Replies

Get a Table Cell's Content Name

Thank you in advance for your help,

 

I have a table, in cell D3  I have inserted a field containing a system variable. The contents of the cell looks like this,

%<\AcVar dimadec>%

 

I want to put in cell D2 the name of the vairable that is in cell D3 - I have tried the following,

%<\AcExpr (D3).ObjectName>%

%<\AcExpr (D3).textstring>%

 

Is there any way to reference the name of that system variable contained in cell D3? I want to do this to prevent errors by curious new users that may edit the table, I want the table to reference itself so that the system variable being read is always related to the correct system variable name.

 

Thanks again

Steve in Alaska

skempp@gci.net

6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: Anonymous

I have also tried

 

(vla-GetCellValue (%<\_ObjId 2130279344 (D,3)>%))

 

(vla-put-TextString(vla-GetCellValue (%<\AcExpr (D,3)>%)))

 

(vla-GetCellValue (%<\AcExpr (D,3)>%))

 

Steve in Alaska

Message 3 of 7
_Tharwat
in reply to: Anonymous

Consider this just as an example Smiley Wink

 

(setq ss (car (entsel "\n Select table:")))
(setq tbl (vlax-ename->vla-object ss))
(vla-settext tbl 2 3 "%<\\AcVar dimadec>%")

 Tharwat

Message 4 of 7
Anonymous
in reply to: _Tharwat

Thank you for such a quick reply, but I think you misunderstood,

%<\AcVar dimadec>% works just fine inside of a table cell, I want to remove the possibility of someone editing a cell next to the one that gets the system variable that describes what that system variable is. So in one cell is a text value "dimadec", the next one over is the set value of dimadec.

 

I have got the following to work most times, it produces "#" when the value is 0 or nil (this is working opposite of putting variable in one cell and reading name of it - this puts the name of variable in a cell and finds the value)

 

Put in table cell d2 - dimadec

Put in table cell d3 - (getvar d2)

 

So I tried a formulae in cell d3

 =(if (= (getvar d2) "") "." (getvar d2))

 

But this returned the same "#" if the sytem value was 0 or nil

 

Steve in Alaska

 

Message 5 of 7
dbroad
in reply to: Anonymous

Seems like you are going to a lot of effort to solve an employee problem.  Training is the best solution.

 

Fields that access cell content will error unless the cell content is a number.  There is no string manipulation or room for diesel in table cell formulas.

 

A fallback that would stop most casual employee errors would be to wrap the table into a block.

Architect, Registered NC, VA, SC, & GA.
Message 6 of 7
hgasty1001
in reply to: dbroad

Hi,

 

You can set a cell to a locked state if you need a read only cell:

 

(vla-SetCellState MyTable row cell 2) will set to read only the cell at (row,cell), 2 is the Internal code for that state.

 

Gaston Nunez

 

 

Message 7 of 7
Anonymous
in reply to: dbroad

Thank you for your advice,

 

I think designing a small table is not so much effort, much easier than going back and fixing something. The table that I am making has System Variables (fields) in one column, the requred settings in the next. An easy to use standards enforcer. Yes, I know there is a batch standards checker - again I feel that having the engineer or designer do it right from the start is better. This is a tool that they can use easy, and I don't have to worry about what they did to make the drawing pass the batch standards checker.

 

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