Suppress the output of standard cancellation messages (defun c:wire ( / *error* col lay opt val var ) Here is a basic example demonstrating the inclusion of a local error handler: Define function, declare local symbols I describe how to do this in my tutorial here. Since the pause symbol evaluates to "\\" you may as well use the literal backslash.Īs an extension, you may also want to consider implementing a local error handler to handle when the user inevitably presses Esc during evaluation of the program (the system variables would otherwise not be reset under such circumstances). Use "\\" in place of the pause symbol, as the pause symbol is an unprotected global variable and can easily be inadvertently redefined outside of your program, causing your program to break. Use getkword in place of getstring to control & validate the user's input. See my tutorial here for more information on how & why you do this. Suppress the value returned by the last evaluated expressionĪlways declare your local variables to avoid clashing with identically named variables in the document namespace. (while (= 1 (logand 1 (getvar 'cmdactive))) (command "\\")) Suppress command-line output for the -LAYER command ( (= opt "Power") (setq lay "POWER" col 7)) ( (= opt "Network") (setq lay "NETWORK" col 210)) ( (= opt "Control") (setq lay "CONTROL" col 10)) ( (= opt "Video") (setq lay "VIDEO" col 150)) ( (= opt "Audio") (setq lay "AUDIO" col 94)) Define the layer & colour based on the option returned Prompt the user for input, default to "Audio" on null input (initget "Audio Video COmm R Control Network Power") (setq var '(clayer orthomode snapmode cmdecho) System variables to be modified within the program Instead, you will need to use a loop to continuously pause for user input before continuing with program evaluation.įor example: Define function, declare local symbols The issue with your code is that you are only pausing for a single user input before attempting to reset the system variables and complete evaluation of the program. I expect the variables to be reset after performing the PLINE command. ![]() (setq P (getstring "Audio(A)/Video(V)/Comm(CO)/Coax(R)/Control(C)/(N)etwork/(P)ower:")) I've tried setting OrthoMode and SnapMode within a command in the LISP, as well as through the (setvar (getvar. I need the PLINE to start, finish, and then the variables get reset. ![]() Once my PLINE command starts, the variables get reset. The program seems to perform the intended function, but not with the intended results. One involves a LISP that is not playing nicely with setting system variables and then resetting them to what they were previously. I'm trying to make drawing wiring diagrams extremely easy in AutoCAD with next to no button presses other than my pre-programmed ones.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |