'If you just need to draw 2D lines when snapping to points or other entities that have a Z elevation other than zero, you can use this LISP routine to accomplish that. 4129 that will help draw lines and polylines and keep them in two dimensions. This will reset current layer in case of error or hit ESC. Clayton Harrison, PE, shares a few LISP routines in response to CAD Tip No. routine returns previous current layer even if the command is ended "dirty" by hit ESC key. routine creates new layer if does not exists yet. command keeps running until user says not to. In the end, I am going with Kent's original post. I kinda wanted something a little general so I could apply the idea to any other codes I might try my hand at in future. plus it had really devolved into a state after trying all my ideas.
#Autocad lisp draw line until exit code#
I am admittedly not a big lisp writer so, fearing my code was a little, eh, awkward, I was hesitant to show it. End it with Enter/Space/Escape, and it will return the current Layer to what it was before you wrote: Start the RX command, and just type an H to make Horizontal Xlines, and pick as many locations as you want, through each of which a horizontal Xline will be drawn, and type a V to switch to Vertical ones, and back and forth between the two directions as often as you like, all within one running of the command - no need for separate XV or XH commands, or to get out of one of them and into the other to switch directions. Its initial default is Xlines , in Free direction.
![autocad lisp draw line until exit autocad lisp draw line until exit](https://i.ytimg.com/vi/tk0PSL1jDgA/maxresdefault.jpg)
You can simply ignore its Ray capability and its other-than-orthogonal specified-Angle options. we don't use rays and I wanted to be able to have XV and XH to be all you needed to get the result. I see how much your command does, but I was hoping for something a little less. I was hoping to be able to understand the part that allows the user to keep creating lines but was unable to sort that out.