Carsten Trolle Posted January 29, 2013 Share Posted January 29, 2013 First some background to this question: Within a lisp function I would like to have block insert in a loop, where the user only left-clicks the give insertion point, loop should be ended at right-mouse-click or ENTER. The actual insert is like this: ... some stuf (while bContinue (command "_.insert" BN pause 1 1 0) (setq bContinue in some way) ) ... some more stuff Maybe same thing can be achieved through different method, but I like the visual of the "insert" where the block is attached to the crosshair until insert. Also I know that the ESC-key (or Cancel) will abort the lsp code at the pause. But for consistency in my application I prefer the ENTER-key or the right-mouse-click. Question is whether there is some way I can make the "pause" react on an ENTER so it aborts the "INSERT" and continue with the lisp code below it. Alternative approaches are also welcome. Hope somebody can help. BR Carsten Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted January 29, 2013 Share Posted January 29, 2013 The only way for the user to exit using either Enter or right-click would be to utilise the getpoint function: (while (setq pt (getpoint "\nInsertion Point: ")) (command "_.-insert" bn "_S" 1.0 "_R" 0.0 "_non" pt) ) However, this will of course forgo the preview you receive when using the INSERT command. The issue arises because when calling the INSERT command from the AutoLISP progam, the INSERT command takes focus from the program and you cannot interact with the user input to the command from within the AutoLISP program until the INSERT command has completed. However, To continue with program evaluation after the user has pressed Esc, I would suggest using the following: (while (vl-cmdf "_.-insert" bn "_S" 1.0 "_R" 0.0 "\\")) This avoids the need to incorporate an error handler (redefined *error* function) in your program. Quote Link to comment Share on other sites More sharing options...
David Bethel Posted January 29, 2013 Share Posted January 29, 2013 You should be able to define a right click as ^C^C ( cancel / escape ) This was the default value for rights clicks for years and years. I still try to define my button menus with this. ***BUTTONS1 ; $p0=* ^C^C ^B ^O ^G ^D ^E ^T My guess is that today, you will use CUI ( not my cup of tea ) -David Quote Link to comment Share on other sites More sharing options...
Carsten Trolle Posted January 30, 2013 Author Share Posted January 30, 2013 Thanks for your reply David. I have also not entered the CUI world myself. Can the redefining of the Right-mouse-click and ENTER-key be restricted to only apply within a particular lisp function (if yes, can I get a hint on how to achieve this), or will it be more universal? BR Carsten Quote Link to comment Share on other sites More sharing options...
David Bethel Posted January 30, 2013 Share Posted January 30, 2013 Can the redefining of the Right-mouse-click and ENTER-key be restricted to only apply within a particular lisp function Good question! Maybe someone knows of a way. -David 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.