Monday, June 17, 2013

Somewhat automated lettering...(diesel macro)

I built this macro this morning upon a challenge issued to me a while ago.  Figured that I could post it on here just in case there is someone else out there that would ever need to use something like this.

To those who would like some way to automate lettering in AutoCAD is a Diesel Macro for LT that will allow you to atleast automate up to "AF":

*^C^C_text;\;$m=$(if, $(<=,$(getvar,userr1),7),$(nth,$(getvar,userr1), A, B, C, D, E, F, G, H),$(if,$(>=,$(getvar,userr1),8),$(nth,$(getvar,userr3), I, J, K, L, M, N, O, P)),)$(if,$(>=,$(getvar,userr1),15),$(nth,$(getvar,userr4), Q, R, S, T, U, V, W, X),)$(if,$(>=,$(getvar,userr1),23),$(nth,$(getvar,userr5), Y, Z, AA, AB, AC, AD, AE, AF),);setvar;userr1;$M=$(+,$(getvar,USERR1),$(getvar,USERR2));setvar;userr3;

This macro requires more input on the users part than the number automation, but it works for a small amount of lettering.

Before you run the command for the first time you need to make sure that your userr1 is set to a value of 0, and that your userr2 is set to a value of 1 (which is for the incrementing).

When you run the command and you place the first letter; you will notice that it prompts you for the userr3, userr4, and userr5 values...just enter through these for now because you won't mess with them until a little further on.

Now, one thing that you need to keep in mind is the letters that are associated with which userr variable:

userr1 - starts at A and ends with H
userr3 - starts at I and ends with P
userr4 - starts at Q and ends with X
userr5 - starts at Y and ends with AF
knowing this will help with understanding when to change variable values as you keep going up the alphabet.  So, for example, once you place an "H"; when the prompt for userr3 appears change it to a value of 0.  Once this is done you don't have to edit it anymore; you can just keep hitting enter through the variables until the end of that letter set on the userr variable.
On another note:
If you are a AutoCAD non-Lt user then the text command is a little different for you.
Instead of:
You will have this:
And then if you want to add justification to it (for example...middle center justification)
If anyone uses this macro and has issues please comment and let us know what changes you had to make to the macro.

Thank you for reading this post!

No comments:

Post a Comment