mwade93 Posted September 4, 2013 Posted September 4, 2013 I have been playing around with these variables, I have not been able to figure out a way to make a string with getenv embedded in the string. For example Rev(X)-Date. Is there a way to prompt the user for just the number (X) with setenv/getenv? Quote
mwade93 Posted September 4, 2013 Author Posted September 4, 2013 I actually answered my own question. It just looks like this: ^C^C^C-la;t;rev$M=$(getenv,users1);; I just have to set users1 before I issue this button. Quote
Tuns Posted September 4, 2013 Posted September 4, 2013 I have a stupid question. I never used the user variables before and always wrote my macro's around them. How do you set the user variables? Quote
mwade93 Posted September 4, 2013 Author Posted September 4, 2013 I used setenv then entered users1 and prompted the user for the answer: ^C^C^Csetenv;users1;\ I know there is a users2 variable but I can't seem to get it to work. Quote
Tuns Posted September 4, 2013 Posted September 4, 2013 Thanks for the info. I'll probably use that in some upcoming macro's. Why do you have 3 escapes? You only need 2 at most. Quote
mwade93 Posted September 4, 2013 Author Posted September 4, 2013 I always use 3 just to make sure. That is a habit I picked up from my instructor I had in the customizing class. How do you normally do your diesel macros then if you don't store anything? Quote
steven-g Posted September 5, 2013 Posted September 5, 2013 Does this work for you, all in one, ^C^C^Csetenv;users1;\-la;t;rev$M=$(getenv,users1);; Quote
Tuns Posted September 5, 2013 Posted September 5, 2013 I always use 3 just to make sure. That is a habit I picked up from my instructor I had in the customizing class. How do you normally do your diesel macros then if you don't store anything? I use the magic of variables already present in the drawing. For the most part I don't really need to store variables for my job. Quote
mwade93 Posted September 5, 2013 Author Posted September 5, 2013 Does this work for you, all in one, ^C^C^Csetenv;users1;\-la;t;rev$M=$(getenv,users1);; That would work except I have 3 other items related to the desired level so I don't want to prompt each and every time. I prompt once then the other buttons do not prompt. I use the magic of variables already present in the drawing. For the most part I don't really need to store variables for my job. The variables never work when I try to use the default system ones. Quote
steven-g Posted September 6, 2013 Posted September 6, 2013 That would work except I have 3 other items related to the desired level so I don't want to prompt each and every time. I prompt once then the other buttons do not prompt. The variables never work when I try to use the default system ones. Could you explain a bit more, it sounds interesting. Quote
mwade93 Posted September 6, 2013 Author Posted September 6, 2013 Tuns Here is the toolbar. The first button sets the level by prompting the user. Next draws a rev cloud on the revX layer. Next one inserts delta with correct number. Last one changes the date on the title block. [ATTACH=CONFIG]43852[/ATTACH] Steven-g Well, for example, if I try to insert the variable dimscale into a macro, it always gives me 1. Basically, it always give me the default system variable as if the value for each variable has never been changed. Quote
Tyke Posted September 6, 2013 Posted September 6, 2013 I know there is a users2 variable but I can't seem to get it to work. The reason you are having trouble with the USERS2 variable is because there are no USERSn variables in LT, just in full AutoCAD. The S stands for a string value. There are USERRn where the R stands for a real value and USERIn where the I stands for an integer value. Here is an extract from the LT User Guide > Command Reference > System Variables: UOSNAP Determines whether object snapping is active for geometry in DWF, DWFx, PDF, and DGN underlays that are attached to the drawing. UPDATETHUMBNAIL Controls updating of the thumbnail previews for views and layouts. USERI1-5 Provides storage and retrieval of integer values. USERNAME Specifies the user name. USERR1-5 Provides storage and retrieval of real numbers. And the link to the page: http://exchange.autodesk.com/autocadlt/enu/online-help/browse#WS73099cc142f48755-1c09418211f25b18dc4-4daa.htm I have read that you can use the variable "strPrefix", but I have no other knowledge on that and I can find no reference to it in the documentation. Quote
Tuns Posted September 6, 2013 Posted September 6, 2013 Tyke, you are a king. You just solved a world of confusion for me. Quote
mwade93 Posted September 6, 2013 Author Posted September 6, 2013 Thank You, that makes sense. Makes it a little less confusing to dumb down my cutomizing Quote
steven-g Posted September 6, 2013 Posted September 6, 2013 DUH! I didn't even spot that you where using getenv and talking about system variables, the click just didn't happen. Quote
mwade93 Posted September 6, 2013 Author Posted September 6, 2013 No problem, I would love to be able to use the system vars but they stuck me with LT. Quote
Tuns Posted September 6, 2013 Posted September 6, 2013 You still can use system variables, just not the string variables. Unless that's what you meant. Quote
steven-g Posted September 6, 2013 Posted September 6, 2013 Hey don't get me wrong you can use them, but it's 'getvar' and 'setvar' that you want. And not 'getenv' and 'setenv' which is a different animal, that's why setenv users1 worked, basically the differenece is that getenv reads variables stored in the windows registery and can have just about any name you choose, and it is available to every drawing, anytime you want until you change that value with setenv, whereas getvar is what you use, to find the variables within the current drawing, and those values are reset for a new drawing to the default values. PS it is the use of getenv/setenv that lets you use strings in variables in LT, but a word of caution setenv will create variables in the registry and they stay there for ever so try and use them sparingly or use the same name each time unless it is something that has a special purpose. Quote
Tuns Posted September 6, 2013 Posted September 6, 2013 That in itself is a landmine almost like x-ref's. If your not paying careful attention you can make a huge mistake. Quote
steven-g Posted September 6, 2013 Posted September 6, 2013 It's not so much a question of mistakes, just something to be aware of, a lot of people don't consider that setenv creates something permanent, so if you are happily using setenv in a macro and the name uses todays date you could end up very quickly with hundreds if not thousands of system variables wasting resources, If the intention is to count how many drawings you have created in a project then fine, but if it's just for a temporary store then get into the habit of using something like temp1, temp2 and stick to that. Quote
Recommended Posts
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.