JWhelp Posted September 20, 2018 Share Posted September 20, 2018 Hi fantastic lisp people, I have a (probably very basic) lisp question. I'm making a basic command to augmenting existing AutoCAD command. I would like this command to act like a vanilla command, ie. repeat on <enter> or <space>. Is this doable? I'm fine if the answer is 'no', or 'no but you can use a "while" loop or the "repeat" command'. F.Y.I - Here's my humble lisp: (defun c:ROT1 () (setq selection1 (ssget)) (command "rotate" selection1 "" pause "r" "@" pause pause) ) Quote Link to comment Share on other sites More sharing options...
dlanorh Posted September 20, 2018 Share Posted September 20, 2018 To run this command you have typed "ROT1" on the command line. If you press enter or spacebar immediately after the command is finished it will repeat. You can access your command history by pressing the up arrow which will step through the command history in reverse order, or just type "ROT1" again Quote Link to comment Share on other sites More sharing options...
JWhelp Posted September 20, 2018 Author Share Posted September 20, 2018 Hi Dlanorh It would be great if it were that simple. I wrote the command and can run it fine and all that jazz. My question was a bit more specific. If you press the enter key it does not repeat the command. It runs the select command - which must be the last command hidden within the 'magic' of the default rotate command? (If it does run again on your machine, could it be possible I have different system variable setting which make the effects different?) Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted September 20, 2018 Share Posted September 20, 2018 I just loaded your ROT1 lisp function, and it does repeat just fine using <enter> or the spacebar, in AutoCAD and BricsCAD. Quote Link to comment Share on other sites More sharing options...
dlanorh Posted September 20, 2018 Share Posted September 20, 2018 2 hours ago, JWhelp said: Hi Dlanorh It would be great if it were that simple. I wrote the command and can run it fine and all that jazz. My question was a bit more specific. If you press the enter key it does not repeat the command. It runs the select command - which must be the last command hidden within the 'magic' of the default rotate command? (If it does run again on your machine, could it be possible I have different system variable setting which make the effects different?) Run the command on your sysytem and press the up arrow to cycle backwards through the command list. Is "ROT1" there? Quote Link to comment Share on other sites More sharing options...
JWhelp Posted September 20, 2018 Author Share Posted September 20, 2018 Yep, "ROT1" is there in the previous commands list. The command works but i can't get it to repeat with "space" or "enter". Maybe this is a system variable thing then? You both don't have a problem with it. Here's my screen shot showing the command line until the command fails on attempting to run it again. Does this shed light on anything? Quote Link to comment Share on other sites More sharing options...
JuniorNogueira Posted September 20, 2018 Share Posted September 20, 2018 It works very well here. Quote Link to comment Share on other sites More sharing options...
dlanorh Posted September 20, 2018 Share Posted September 20, 2018 What do the sysvars "INPUTHISTORYMODE" "DYNMODE" and "DYNPROMPT" give you? Quote Link to comment Share on other sites More sharing options...
JWhelp Posted September 21, 2018 Author Share Posted September 21, 2018 INPUTHISTORYMODE <15>: DYNMODE <3>: DYNPROMPT <1>: ? Quote Link to comment Share on other sites More sharing options...
dlanorh Posted September 21, 2018 Share Posted September 21, 2018 20 hours ago, JWhelp said: If you press the enter key it does not repeat the command. It runs the select command Sorry, but i missed this bit. If Its asking you to select again then the lisp IS repeating. Or do you mean you automatically want to select the last object again? Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted September 21, 2018 Share Posted September 21, 2018 33 minutes ago, dlanorh said: If Its asking you to select again then the lisp IS repeating. Or do you mean you automatically want to select the last object again? No. The (ssget) in the lisp which prompts the user to "Select objects:" is not the same as the SELECT command. Check the image in post 6. Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted September 21, 2018 Share Posted September 21, 2018 @JWhelp - try this. Run the ROT1 command and finish it. Then right-click in the drawing editor area, and look at the context menu. Does it say "Repeat ROT1" and is ROT1 listed under "Recent Input"? Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted September 21, 2018 Share Posted September 21, 2018 Try running the native built-in ROTATE command. Does it fail to repeat with the space bar or <enter> also? Here is someone with a similar problem, he is running the ROTATE command (which is what you lisp is doing), and then the space bar or <enter> executes the SELECT command. It looks like an add-on is causing the issue 2 Quote Link to comment Share on other sites More sharing options...
JWhelp Posted September 21, 2018 Author Share Posted September 21, 2018 Quote Link to comment Share on other sites More sharing options...
JWhelp Posted September 21, 2018 Author Share Posted September 21, 2018 rkmcswain - You are totally right! it doesn't repeat either so its not my lisp afterall! Thank you Doctor, I'll check out you link above now. Quote Link to comment Share on other sites More sharing options...
JWhelp Posted September 21, 2018 Author Share Posted September 21, 2018 Genius! ...and i thought this was all about my dodgy scripting skills! Thanks very much for this one. Much appreciate everyone's help! 1 Quote Link to comment Share on other sites More sharing options...
rkmcswain Posted September 21, 2018 Share Posted September 21, 2018 A few of these trophy clicks would be the way to say thanks! 1 Quote Link to comment Share on other sites More sharing options...
dlanorh Posted September 21, 2018 Share Posted September 21, 2018 4 hours ago, rkmcswain said: No. The (ssget) in the lisp which prompts the user to "Select objects:" is not the same as the SELECT command. Check the image in post 6. I cannot see any image in post 6. Something is filtering out *.jpg in my browser. I can see the *.png and *.gif but not *.jpg. Quote Link to comment Share on other sites More sharing options...
JWhelp Posted September 22, 2018 Author Share Posted September 22, 2018 (edited) Sorry about that! I should remeber to copy from the comand line too, in case someone has a similar problem with viewing jpegs in the future. The image shows that after my script runs, when I press <enter> the SELECT comand runs (Not the ROT1 as expected) My problem was caused by a third party plugin called ' DiLeader ' - which I have now uninstalled. It was supposed to create dynamic leaders with text populated automatically based on what object you were pointing at. It was a bit glitchy and also caused this problem - commands not repeat properly! All good now tho! Edited September 22, 2018 by JWhelp Quote Link to comment Share on other sites More sharing options...
dlanorh Posted September 22, 2018 Share Posted September 22, 2018 1 hour ago, JWhelp said: Sorry about that! I should remeber to copy from the comand line too, in case someone has a similar problem with viewing jpegs in the future. The image shows that after my script runs, when I press <enter> the SELECT comand runs (Not the ROT1 as expected) My problem was caused by a third party plugin called ' DiLeader ' - which I have now uninstalled. It was supposed to create dynamic leaders with text populated automatically based on what object you were pointing at. It was a bit glitchy and also caused this problem - commands not repeat properly! All good now tho! Thanks for the update. My problem has been solved by a browser update. It found a corrupt file. 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.