Lee Mac Posted June 25, 2009 Posted June 25, 2009 I think I'll let Se7en take this one, as he seems to know more about putting things on shelves than I do... Quote
Se7en Posted June 25, 2009 Posted June 25, 2009 Perfect! So i was correct. The above code model is not good for you. I suggest that you develop some pseudo code. Pseudo code is very easy to do; write down in plain English what you want to accomplish step by step. -e.g. Prompt user for scale factor Grab all text from the drawing determine the scale of text build a list of all text entities which need to be altered Iterate the list and scale text entities as necessary based upon end users scale prompt Ensure that paper space is active switch to paper space if necessary ... This logic is difficult and you will/should revise it several times before you produce any code. the actual code is the easy part --i should say tedious part-. develop flow and think of counter actions and how the users will can break the chain of operations. Doing this will give you a very good head start. Quote
Se7en Posted June 25, 2009 Posted June 25, 2009 I think I'll let Se7en take this one, as he seems to know more about putting things on shelves than I do... Sorry, i dont give people fish. I wont be doing much more then giving out pieces, snipits, and such. Rarely, i will revamp an app but i almost never give out a full fledged working version. I learned that lesson a long time ago. Quote
Lee Mac Posted June 25, 2009 Posted June 25, 2009 Sorry, i dont give people fish. I wont be doing much more then giving out pieces, snipits, and such. Rarely, i will revamp an app but i almost never give out a full fledged working version. I learned that lesson a long time ago. Maybe I should start to do the same - you start to give, and people never stop taking... Quote
Freerefill Posted June 25, 2009 Posted June 25, 2009 Perfect! So i was correct. The above code model is not good for you. I suggest that you develop some pseudo code. Pseudo code is very easy to do; write down in plain English what you want to accomplish step by step. -e.g. Prompt user for scale factor Grab all text from the drawing determine the scale of text build a list of all text entities which need to be altered Iterate the list and scale text entities as necessary based upon end users scale prompt Ensure that paper space is active switch to paper space if necessary ... This logic is difficult and you will/should revise it several times before you produce any code. the actual code is the easy part --i should say tedious part-. develop flow and think of counter actions and how the users will can break the chain of operations. Doing this will give you a very good head start. I'd just like to re-iterate just how useful this is. When I write a program and I'm stuck and overwhelmed at what it is I'm about to do, and I'm trying to piece everything together in my head, it helps a LOT to just hit a semi-colon and start jotting down notes in the code itself, breaking it up into manageable bits, just as you see here. This is always good practice in everything you do, not just coding. It really, really does help a lot. Quote
Se7en Posted June 25, 2009 Posted June 25, 2009 Maybe I should start to do the same - you start to give, and people never stop taking... yeah that's one of the reasons along with appreciation, understanding, maintenance, etc., etc., blah, blah, blah. ...I'm up front and honest about it; I wont give you a full fledged program. I may give you 90% or 10% but its up to you do do the work. But on that same note, i give away everything i do that is worth anything. Quote
Rooster Posted June 25, 2009 Author Posted June 25, 2009 Maybe I should start to do the same - you start to give, and people never stop taking... I just want to point out that I'm not here to take advantage of everybody's generosity in helping me out. lee especially has helped me a number of times & I greatly appreciate it. I'm not asking anyone to write my entire lisp for me - I'm just coming here when I encounter problems to get some help. Who knows, maybe one day I'll know enough about it all to help someone out myself..... Quote
Se7en Posted June 25, 2009 Posted June 25, 2009 I just want to point out that I'm not here to take advantage of everybody's generosity in helping me out. lee especially has helped me a number of times & I greatly appreciate it. I'm not asking anyone to write my entire lisp for me - I'm just coming here when I encounter problems to get some help. Who knows, maybe one day I'll know enough about it all to help someone out myself..... No, no one is thinking that! We are on a forum. We wouldn't post or be here if we didn't want to help. We were just talking about the ``teach a man to fish...'' adage. Quote
Lee Mac Posted June 25, 2009 Posted June 25, 2009 I just want to point out that I'm not here to take advantage of everybody's generosity in helping me out. lee especially has helped me a number of times & I greatly appreciate it. I'm not asking anyone to write my entire lisp for me - I'm just coming here when I encounter problems to get some help. Who knows, maybe one day I'll know enough about it all to help someone out myself..... Of course Rooster - I'm not pointing the finger here - just from experience, that is the impression you get. Quote
rcb007 Posted March 15 Posted March 15 I am trying to piece together the rest of the code from the above. (or *ans* (setq *ans* "A")) (initget "A B C") (or (not (setq ans (getkword (strcat "\nSelect a Letter [A/B/C] <" *ans* ">: ")))) (setq *ans* ans)) I then saw the Dynamic Input on Lee's website. (if (null global:ans) (setq global:ans "Alpha") ) (initget "Alpha Beta Gamma") (if (setq tmp (getkword (strcat "\nChoose [Alpha/Beta/Gamma] <" global:ans ">: "))) (setq global:ans tmp) ) I am trying to piece it together but I am not able to get it to work. Any ideas? (defun c:test1 (/ global ans tmp) (if (null global:ans) (setq global:ans "30") ) (initget "10 20 30") (if (setq tmp (getkword (strcat "\nChoose [10/20/30] <" global:ans ">: "))) (setq global:ans tmp) ) (cond ((eq tmp "10") (alert "... Do something 10 ...") ) ((eq tmp "20") (alert "... Do something 20 ...") ) ((eq tmp "30") (alert "... Do something 30 ...") ) ) (princ)) Thanks for any help! Quote
pkenewell Posted March 15 Posted March 15 (edited) 19 minutes ago, rcb007 said: I am trying to piece it together but I am not able to get it to work. Any ideas? I think you're just missing one small part: (if (setq tmp (getkword (strcat "\nChoose [10/20/30] <" global:ans ">: "))) (setq global:ans tmp) (setq tmp global:ans);<-Add this to set tmp variable to the default variable if the user just hits ENTER. ) Edited March 15 by pkenewell 1 Quote
Lee Mac Posted March 15 Posted March 15 Instead of (eq tmp "10") use (eq global:ans "10") or better yet (= global:ans "10") 1 Quote
rcb007 Posted March 18 Posted March 18 Thank you for the help!! Thank you for pointing our the one line I missed. Lee, I like simple. One other question. How would you save the variable to a users windows profile? (If the user would to close cad completely. Then restart and run the command again.) How would you set same value as the above's routine? Quote
Lee Mac Posted March 18 Posted March 18 Consider using either the setenv & getenv functions, or saving the values to a plain text file (e.g. .cfg). Quote
BIGAL Posted March 19 Posted March 19 (edited) Your welcome to use this replaces initget. There is examples at top of code, save the file to a support directory as you must use (load "multi radio buttons") (setq ans (ah:butts 1 "V" '("A B C D " "A" "B" "C" "D" ))) (setq ans (atoi (ah:butts 1 "V" '("Please choose " "10" "20" "30" "40" )))) Multi radio buttons.lsp Edited March 19 by BIGAL 1 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.