uuoo10levi Posted August 22, 2013 Share Posted August 22, 2013 Is it possible to list a variable value in the command line. For example using single line text after you pick your base point it prompts "Specify height :". I want to know if I can put the textsize variable or any other value into a setq value since its always changing and when I run a command I will see the current value set to that variable. Thanks! Quote Link to comment Share on other sites More sharing options...
steven-g Posted August 22, 2013 Share Posted August 22, 2013 Take a look in the help file at MODEMACRO Quote Link to comment Share on other sites More sharing options...
hmsilva Posted August 22, 2013 Share Posted August 22, 2013 Is it possible to list a variable value in the command line. For example using single line text after you pick your base point it prompts "Specify height :". I want to know if I can put the textsize variable or any other value into a setq value since its always changing and when I run a command I will see the current value set to that variable. Thanks! If I understood correctly, perhaps something like this (setq txth (getreal (strcat "Specify height <"(rtos (getvar 'TEXTSIZE))">: " ))) (if (not txth) (setq txth (getvar 'TEXTSIZE))) Henrique Quote Link to comment Share on other sites More sharing options...
uuoo10levi Posted August 22, 2013 Author Share Posted August 22, 2013 That's it. Thanks hmsilva! Quote Link to comment Share on other sites More sharing options...
hmsilva Posted August 22, 2013 Share Posted August 22, 2013 You're welcome, uuoo10levi glad I could help Henrique Quote Link to comment Share on other sites More sharing options...
MSasu Posted August 23, 2013 Share Posted August 23, 2013 Just for the sake of terminology, what you were looking for is to prompt user with default value. Quote Link to comment Share on other sites More sharing options...
neophoible Posted August 23, 2013 Share Posted August 23, 2013 Just for the sake of terminology, what you were looking for is to prompt user with default value.Yeah, and it wouldn't really be a command either. If the solution is correct, then you might allow the user more input leeway and also save the default rather than getting the variable twice, though I cannot say how fast or efficient either is these days. (setq DefaultTextHeight (getvar "TEXTSIZE") UserTextHeight (cond ( (getdist (strcat "\nSpecify height <" (rtos DefaultTextHeight) ">: " ) ) ) ( DefaultTextHeight ) ) ) I'm sure there are even better ways to do this, and in most cases the default should be updated, and perhaps even the system variable. Quote Link to comment Share on other sites More sharing options...
hmsilva Posted August 24, 2013 Share Posted August 24, 2013 Yeah, and it wouldn't really be a command either. If the solution is correct, then you might allow the user more input leeway and also save the default rather than getting the variable twice, though I cannot say how fast or efficient either is these days. As for "allow the user more input leeway", agree, was my failure, were just some quick and dirty code lines, in order to understand the OP needs... As for "getting the variable twice", I don't see what the problem is, even if it leads to a lack of efficiency(???), is so small, that I don't know if it is worth to creating another variable if you don't need to retain the "TEXTSIZE" System Variable value... I'm sure there are even better ways to do this, and in most cases the default should be updated, and perhaps even the system variable. I fully agree! So, if you don't need to retain the "TEXTSIZE" System Variable value, maybe something like this (cond ((setq NewTextHeight (getdist (strcat "\nSpecify height <" (rtos (getvar 'TEXTSIZE))">: "))) (setvar 'TEXTSIZE NewTextHeight) ) ((setq NewTextHeight (getvar 'TEXTSIZE))) ) In case of being necessary to retain the "TEXTSIZE" System Variable value, maybe something like this (cond ((setq NewTextHeight (getdist (strcat "\nSpecify height <" (rtos (setq OldTextHeight (getvar 'TEXTSIZE)))">: "))) (setvar 'TEXTSIZE NewTextHeight) ) ((setq NewTextHeight OldTextHeight)) ) These would be a way that I would write these code lines, I'm not saying that would be the correct way... Henrique Quote Link to comment Share on other sites More sharing options...
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.