Sequential numbering with prefix

Sequential numbering with prefix

accuratedd
Participant Participant
3,137 Views
10 Replies
Message 1 of 11

Sequential numbering with prefix

accuratedd
Participant
Participant

I'm trying to add numbering to my drawing with a prefix followed by sequential numbers, for example: E03.01. I've searched the forums here and found this:

 

http://forums.autodesk.com/t5/autocad-lt-general-discussion/adding-numbers-sequentially/td-p/1155787

 

Not pretty but it works on AutoCAD LT2005 don't know about other versions cos deisel syntax has been changable but:

Stick this on a user defined button to set a prefix and number to start at:

^C^Csetenv PREFIX \; setvar USERI1;

And this on another to do the sequential thingy:

*^C^C-text;\;$M=$(getenv,PREFIX)$M=$(getvar,USERI1);setvar;USERI1;$(+,1,$(getvar,USERI1))

 

 

Setting PREFIX and USERI1 works fine but I can't seem to get the text placement to work properly. It seems to want to run thru the TEXT command and ignore the variable settings. I'm running LT 2014. Any help at all would be greatly appreciated, thanks.

 

 

0 Likes
Accepted solutions (1)
3,138 Views
10 Replies
Replies (10)
Message 2 of 11

pendean
Community Legend
Community Legend
Your macro ignores the angle prompt (and maybe even the text size) that -TEXT command requires perhaps?
Plus USERI1 doesn't allow periods here, no 30.01 but 3001 is OK. Not sure how that used to work in 2005, that was ages ago 🙂
Message 3 of 11

accuratedd
Participant
Participant
Accepted solution

Dean,

 

You're right, the period and prompts were messing it up. I corrected both and added justification. If anyone's interested in it, here's the current version:

 

Preset a prefix and number to start from:

 

^C^Csetenv PREFIX \; setvar USERI1;

 

Sequential numbering:

 

*^C^C-text;J;M;\;;$M=$(getenv,PREFIX)$M=$(getvar,USERI1);setvar;USERI1;$(+,1,$(getvar,USERI1))

 

 

The script uses current prompt values - text height, rotation, etc. Mine are preset in my templates.

 

Thanks for your help Dean and thanks to the original poster Root.

Message 4 of 11

Imui
Advocate
Advocate

Hello

why is the PREFIX "env" and the USERI1 "var"?

0 Likes
Message 5 of 11

pendean
Community Legend
Community Legend
SETVAR calls a variable already in AutoCAD LT.
SETENV creates a custom "variable" outside of LT in your Windows Registry: it's a great way to create unique "variables" tailored to you and your exact needs without waiting for Autodesk to create it in the program.
0 Likes
Message 6 of 11

Imui
Advocate
Advocate
Sorry, i was not clear enough.
I din not ask what they are, i asked why.
Is there a reason why they cant be both env or var?
Sorry in advance if my question is stupid.
0 Likes
Message 7 of 11

steven-g
Mentor
Mentor

As pendean said the setvar, references existing variables in Autocad LT, but LT only has a very limited number of variables that you can use (10 of them) for this sort of thing, and you cannot create your own variables, but these can only be used to store numbers (USERR1-5 real & USERI1-5 integer), the setenv works in a similar way and you can create as many as you need, so you have to use setenv for text values, in theory you could use these for numbers as well, but these stay permanently in the windows registry, so most people avoid cluttering up the registry in that way, so yes both could have used env but not var

Message 8 of 11

Imui
Advocate
Advocate
Thank you for taking the time and explaining
0 Likes
Message 9 of 11

Anonymous
Not applicable

This is the closest solution I've found......

 

*^C^C-text;J;M;\;;$M=$(getenv,PREFIX)$M=$(getvar,USERI1);setvar;USERI1;$(+,1,$(getvar,USERI1))

 

However, I always get a '1' as a prefix and it doesn't seem to have a reset. 

0 Likes
Message 10 of 11

Anonymous
Not applicable

........... I've been messing about and have got it to work like this.......

removed this from the macro......(getenv,PREFIX)$M=$......

You have to set text values first and then manually reset SETVAR value

0 Likes
Message 11 of 11

Anonymous
Not applicable

So what was the final code for the 2 macros?  I got lost.

 

I would love to put a prefex in front of a sequential numbering input.

0 Likes