AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Convert/Read attribute value into a variable for LISP/Circuit Builder use

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
AJPopp
745 Views, 2 Replies

Convert/Read attribute value into a variable for LISP/Circuit Builder use

AJPopp
Contributor
Contributor

Basically what I'm trying to do within Circuit Builder is have them insert a symbol, that attaches the correct catalog lookup info, then somehow set a variable equal to the value from an attribute on that symbol (let's say RATING5), so I can then insert a second symbol, but what/which symbol depends on what value is on RATING5.

 

I can get the info to get set from the catalog database onto the first symbol, & I can get the different 2nd symbol to insert based upon variables, but I can't figure out a way to do an IF or COND statement off an attrible value, so I'm trying to see if I can read it from the attribute into a variable.

 

Any ideas?

0 Likes

Convert/Read attribute value into a variable for LISP/Circuit Builder use

Basically what I'm trying to do within Circuit Builder is have them insert a symbol, that attaches the correct catalog lookup info, then somehow set a variable equal to the value from an attribute on that symbol (let's say RATING5), so I can then insert a second symbol, but what/which symbol depends on what value is on RATING5.

 

I can get the info to get set from the catalog database onto the first symbol, & I can get the different 2nd symbol to insert based upon variables, but I can't figure out a way to do an IF or COND statement off an attrible value, so I'm trying to see if I can read it from the attribute into a variable.

 

Any ideas?

2 REPLIES 2
Message 2 of 3
PatMurnen_Adsk
in reply to: AJPopp

PatMurnen_Adsk
Alumni
Alumni

I am not sure I fully understand what you are trying to do but maybe we can work on this together offline? I have some experience with Circuit Builder and it seems like it can be done but it just might take a few tries to get it right. I want to investigate a little more the API c:ace_cb_save as it seems like it might be useful along with c:ace_cb_eval.

 

You can contact me directly at pat.murnen@autodesk.com. Let me know what version of AutoCAD Electrical you are using and if you can send your current circuit builder spreadsheet with ehat you have so far it would be helpful.

 

Regards,

Pat Murnen



Pat Murnen
Principal Content Developer
Product Development – AutoCAD Product Line Group

Autodesk, Inc.

0 Likes

I am not sure I fully understand what you are trying to do but maybe we can work on this together offline? I have some experience with Circuit Builder and it seems like it can be done but it just might take a few tries to get it right. I want to investigate a little more the API c:ace_cb_save as it seems like it might be useful along with c:ace_cb_eval.

 

You can contact me directly at pat.murnen@autodesk.com. Let me know what version of AutoCAD Electrical you are using and if you can send your current circuit builder spreadsheet with ehat you have so far it would be helpful.

 

Regards,

Pat Murnen



Pat Murnen
Principal Content Developer
Product Development – AutoCAD Product Line Group

Autodesk, Inc.

Message 3 of 3
AJPopp
in reply to: PatMurnen_Adsk

AJPopp
Contributor
Contributor
Accepted solution

I worked with Pat offline & we came up with a solution.  I'm posting them here incase anyone else has the same question.

 

Basically when using the c:ace_cb_save command, it saves the value as a string.  Since I was needing a number, you had to nest a c:ace_cb_get inside a atof command to get it converted into a number.

 

So we used (c:ace_cb_save "@ET@" "RATING5" nil 0) to save the attribute RATING5 value as a string in @ET@ then I used (c:ace_cb_eval "(setq ETP (atof (c:ace_cb_get '@ET@' nil)))") to save that value as a number in my variable ETP, which I can then use in IF/COND commands as well as c:ace_cb_attr commands that only take a variable with a number (no strings).

0 Likes

I worked with Pat offline & we came up with a solution.  I'm posting them here incase anyone else has the same question.

 

Basically when using the c:ace_cb_save command, it saves the value as a string.  Since I was needing a number, you had to nest a c:ace_cb_get inside a atof command to get it converted into a number.

 

So we used (c:ace_cb_save "@ET@" "RATING5" nil 0) to save the attribute RATING5 value as a string in @ET@ then I used (c:ace_cb_eval "(setq ETP (atof (c:ace_cb_get '@ET@' nil)))") to save that value as a number in my variable ETP, which I can then use in IF/COND commands as well as c:ace_cb_attr commands that only take a variable with a number (no strings).

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

Post to forums  

Autodesk Design & Make Report