Andrew1979 Posted July 11, 2015 Share Posted July 11, 2015 I want to display in the command prompt the last variable a user inputted. I want it like the Offset command. In the offset command, it asks the user for a distance, and the next time the user runs the command offset remembers the last distance. I am using getint. I have this so far: [color=red]([/color][color=royalblue]setq[/color] MDF-WDE [color=red]([/color][color=royalblue]getint[/color] "\nEnter MDF thickness <[color=magenta]???[/color]> << "[color=red]))[/color] The bit in the code where I have ??? is where I want to display the users last entry. How do I do this? I have no idea how to write a variable inside the getint command, when I do put a variable in there, it fails to work. Quote Link to comment Share on other sites More sharing options...
sergiu_ciuhnenco Posted July 11, 2015 Share Posted July 11, 2015 some of the gurus advice me few months ago to explore INPUTHISTORYMODE sysvar. Maybe I will find a way to make it work , but nothing good. You can try , may be you will succeed Quote Link to comment Share on other sites More sharing options...
Andrew1979 Posted July 12, 2015 Author Share Posted July 12, 2015 thanks, haven't heard of that command before....I thought you made it up until i tried it haha. Not sure if that is what I am looking for though. Can't seem to work out how the AutoCAD offset command works with showing the last offset in the command prompt text. I have tried multiple ways but can't work it out. Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 12, 2015 Share Posted July 12, 2015 lots of variables can be read in your case offsetdist (getvar "offsetdist") same with circle circelrad & fillet filletrad another lastpoint. (setq offdist (getvar "offsetdist")) (setq MDF_WDE (getint (strcat "Enter thicknes <" (rtos offdist 2 0) ">"))) (if (= MDF_WDE nil) (setq MDF_WDE offdist)) Quote Link to comment Share on other sites More sharing options...
Andrew1979 Posted July 12, 2015 Author Share Posted July 12, 2015 thanks BIGAL, you are to the rescue again. I didn't know you could strcat inside a get function. Thanks Quote Link to comment Share on other sites More sharing options...
Andrew1979 Posted July 12, 2015 Author Share Posted July 12, 2015 (edited) just for reference for others, here is the code I used: [color=red]([/color][color=blue]initge[/color]t [color=seagreen]6[/color][color=red]) [color=black][color=red]([/color][color=royalblue]if [/color][color=red]([/color][color=royalblue]= [/color]offdist [color=royalblue]nil[/color][color=red])([/color][color=royalblue]setq [/color]offdist [color=seagreen]18[/color][color=red])[/color] [color=red] ) [/color][/color] [/color] [color=red]([/color][color=blue]setq[/color] MDF-WDE [color=red]([/color][color=blue]getint[/color] [color=red]([/color][color=blue]strcat[/color] [color=magenta]"\nEnter MDF thickness <"[/color] [color=red]([/color][color=blue]rtos[/color] offdist [color=seagreen]2 0[/color][color=red])[/color][color=magenta] "mm> << "[/color][color=red])))[/color] [color=red]([/color][color=blue]COND[/color] [color=red]([/color][color=blue][color=red]([/color]= [/color]MDF-WDE[color=blue] nil[/color][color=red])([/color][color=blue]setq[/color] offdist offdist[color=red])([/color][color=blue]setq[/color] MDF-WDE offdist[color=red]))[/color] [color=red](([/color][color=blue]/=[/color] MDF-WDE [color=blue]nil[/color][color=red])([/color][color=blue]setq[/color] offdist MDF-WDE[color=red])([/color][color=blue]setq[/color] MDF-WDE MDF-WDE[color=red]))[/color] [color=red])[/color] This code returns the last value entered by a user and shows it in the command prompt. If the user then presses enter without typing anything, it will use the last number used. Edited July 12, 2015 by Andrew1979 Quote Link to comment Share on other sites More sharing options...
BIGAL Posted July 13, 2015 Share Posted July 13, 2015 Code redone applying a variable as its existing value is not needed. (initget 6) (if (= offdist nil)(setq offdist 18) ) (setq MDF-WDE (getint (strcat "\nEnter MDF thickness <" (rtos offdist 2 0) "mm> << "))) (if (= MDF-WDE nil)(setq MDF-WDE offdist)(setq offdist MDF-WDE)) ; updates value of offdist for next time 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.