Jump to content

I am puzzled at this...


mwade93

Recommended Posts

I am trying to make code that when it changes vars it resets them. However, I have run into an issue. If i use this code, it works perfect, stores menuecho and then resets it:

^C^C^Csetvar;useri3;$M=$(getvar,menuecho);menuecho;2;menuecho;"$M=$(getvar,useri3)";

The action part of the code would go in the middle of this such as this (it is just inserting an attributed block, the # symbols are used so I can mass remove them with an attreq at end because insertion wont allow blanks):

^C^C^Csetvar;useri3;$M=$(getvar,menuecho);setvar;useri2;$M=$(getvar,attreq);menuecho;2;attreq;1;-insert;baringsch;\1;1;0;48;1;REFRIGERATED DISPLAY CASE;FEDERAL IND.;ELPRSS3;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;120;1;16;#;#;DGR;4";#;#;-attedit;n;n;baringsch;*;*;#;;menuecho;"$M=$(getvar,useri3)";attreq;"$M=$(getvar,useri2)";

 

However, when I use the second example it hiccups and I get this:

Command: setvar

Enter variable name or [?] : useri3

Enter new value for USERI3 : $M=DISPLAY

Requires an integer between -32768 and 32767.

 

I am just completely confused as to why this is happening.

Edited by mwade93
Link to comment
Share on other sites

First guess is you are missing the closing quote at the end, but I will need to decipher what is going on first.

 

I actually fixed that on my end already, but I don't even get that far into the line of code. It never sets the useri2 or useri3 variables. The middle part works fine, I just can't get to it without it hiccuping.

Link to comment
Share on other sites

I don't have your block, so I ran a test with a block with just 2 attributes, and it all runs fine, can you post a blank drawing with the block in it

Link to comment
Share on other sites

It is not actually our block, its a clients we work with frequently, so unfortunely no....:x. Did you use the code exactly as it sits in my first post or did you change it?

Link to comment
Share on other sites

changed it in as much as I took out a load of the attribute values, the only other thing I could think of is that at the start of the insert command you have \1;1;0;48 etc. is 48 your first attribute value, if so take out one of the 1's so you get \1;0;48 and try that.

Link to comment
Share on other sites

I never get to that point though. It hiccups when it is trying to set the first variable.

 

Command: setvar

Enter variable name or [?] : useri3

Enter new value for USERI3 : $M=DISPLAY

Requires an integer between -32768 and 32767.

Link to comment
Share on other sites

Then we'll try it the other way round, attached is the test block I used. And here is the altered code

^C^C^Csetvar;useri3;$M=$(getvar,menuecho);setvar;useri2;$M=$(getvar,attreq);menuecho;2;attreq;1;-insert;test;\1;0;a;#;-attedit;n;n;test;*;*;#;;menuecho;"$M=$(getvar,useri3)";attreq;"$M=$(getvar,useri2)";

testblock.dwg

Link to comment
Share on other sites

found it ---4"---, scripts and macro's don't like em, can you leave out the " symbol or use something else, a double tick for example ''

Link to comment
Share on other sites

found it ---4"---, scripts and macro's don't like em, can you leave out the " symbol or use something else, a double tick for example ''

 

I took out the " symbol and added 2 '. It now stores useri3 correctly, but i am still getting an error with useri2. I copied the setvar part from the first part of the code and just changed it useri2 and changed the variable, so it can't be an error of mistyping characters.

 

Command: setvar

Enter variable name or [?] : useri3

Enter new value for USERI3 : 4

Command: setvar

Enter variable name or [?] : useri2

Enter new value for USERI2 : $M=1

Requires an integer between -32768 and 32767.

Enter new value for USERI2 : *Cancel*

Command: *Cancel*

 

PM me your email and I can send you the block. Wish I could just PM you the drawing.

Link to comment
Share on other sites

steven-g has been helping me and this is what he has come up with. This works without any hiccups but we have still not discovered about menuecho.

 

^C^C^Csetvar;useri2;$M=$(getvar,attreq);attreq;1;-insert;baringsch;\1;1;0;48;1;REFRIGERATED DISPLAY CASE;FEDERAL IND.;ELPRSS3;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;#;120;1;16;#;#;DGR;4'';#;#;-attedit;n;n;baringsch;*;*;#;;attreq;$(getvar,useri2);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...