jcrayford Posted August 15, 2013 Posted August 15, 2013 Hello all, I'm trying to create a custom LISP which will: 1) actively switch layers based on user input 2) receive input from user for Civil COGO point number(s) 3) draw a line on active layer using 'PN transparent command 4) exit cleanly out of both 'PN transparent command and previous line command 5) carry on with more function of LISP When testing manually, I can do the above steps and exit out of the 'PN command by pressing "ESC" once to get me back to the line command, then press "ESC" again to get me back to the empty command prompt. However, I can't come up with the coding for "ESC" within the LISP to cancel out of the 'PN command and the line command. Any chance someone can shed some light on this? Thanks, J. Quote
Commandobill Posted August 15, 2013 Posted August 15, 2013 Check out Lee's tutorial on Error handling here This should help you ESC out of commands without much issue. Quote
jcrayford Posted August 15, 2013 Author Posted August 15, 2013 Check out Lee's tutorial on Error handling here This should help you ESC out of commands without much issue. Yep, I'll need some error-trapping coding later on as well, but for now I need to exit cleanly out of a transparent command and base AutoCAD command, then continue on with LISP functions. Lee's information is top notch, but what you've referred to is for error-trapping.... Thanks for that link. Still searching. J. Quote
Commandobill Posted August 15, 2013 Posted August 15, 2013 Yep, I'll need some error-trapping coding later on as well, but for now I need to exit cleanly out of a transparent command and base AutoCAD command, then continue on with LISP functions. Lee's information is top notch, but what you've referred to is for error-trapping.... Thanks for that link. Still searching. J. I should have read closer. Without seeing the code, I can't be of much help. Quote
jcrayford Posted August 15, 2013 Author Posted August 15, 2013 Snippet of code: (setq 1pnt (getreal "Point Number")) (setq 2pnt (getreal "Point Number")) ;;; Need to write subroutine to draw line on specified layer from above using 'PN, then cancel out to continue ;;; line of code below DOES NOT work (command "line" "'PN" 1pnt 2pnt "CANCEL") Quote
Commandobill Posted August 15, 2013 Posted August 15, 2013 Make sure you put your code into code brackets before you get yelled at... Snippet of code: (setq 1pnt (getreal "Point Number")) (setq 2pnt (getreal "Point Number")) ;;; Need to write subroutine to draw line on specified layer from above using 'PN, then cancel out to continue ;;; line of code below DOES NOT work [color=red](command "line" "'PN" 1pnt 2pnt "CANCEL") <--- Need a cancel here to get out of 'PN transparent[/color] Try this... (command "line" "'PN" 1pnt 2pnt "") Double quotes acts as if you were hitting the enter key. Quote
jcrayford Posted August 15, 2013 Author Posted August 15, 2013 Make sure you put your code into code brackets before you get yelled at... Try this... (command "line" "'PN" 1pnt 2pnt "") Double quotes acts as if you were hitting the enter key. Thanks CB, but that same command when typed into CIVIL does not get me out of the 'PN transparent command at all; while in the command I can finish the line on point #2 and hit enter as much as I want and it never exist the transparent command.... J. Quote
Commandobill Posted August 15, 2013 Posted August 15, 2013 Thanks CB, but that same command when typed into CIVIL does not get me out of the 'PN transparent command at all; while in the command I can finish the line on point #2 and hit enter as much as I want and it never exist the transparent command.... J. I don't have civil, so this makes it only slightly more dificult. Try putting in : (command "line" "'PN" 1pnt 2pnt)(command) Quote
BIGAL Posted August 16, 2013 Posted August 16, 2013 Set your input 1pnt as part of "IF" so you check if 1pnt is "nil" then continue on a Nil can be a press. (setq 1pnt (getreal "\nEnter pt num or press <Cr. to exit) (if (/= 1pnt nil) (prong (setq 2pnt (getreal "\nEnter Pt num")) (Command "Line" "'pn" 1pnt 2pnt "") ; note "" is same as command ) ) Quote
Commandobill Posted August 16, 2013 Posted August 16, 2013 Set your input 1pnt as part of "IF" so you check if 1pnt is "nil" then continue on a Nil can be a press. I had suggested putting "" in there first, but he said ti didn't work... huh... Quote
jcrayford Posted August 19, 2013 Author Posted August 19, 2013 Set your input 1pnt as part of "IF" so you check if 1pnt is "nil" then continue on a Nil can be a press. (setq 1pnt (getreal "\nEnter pt num or press <Cr. to exit) (if (/= 1pnt nil) (prong (setq 2pnt (getreal "\nEnter Pt num")) (Command "Line" "'pn" 1pnt 2pnt "") ; note "" is same as command ) ) Thanks BigAl, but the problem isn't cancelling out of the sequence where the LISP is asking for another point input; it's trying to cancel out of the transparent Point Number ('PN) command in the (command "Line".... Any input where Civil is waiting for a valid point number is just a simple carriage return; doesn't cancel out of the point number prompt to back out of the line command. Anymore suggestions anyone? J. Quote
Commandobill Posted August 23, 2013 Posted August 23, 2013 Set your input 1pnt as part of "IF" so you check if 1pnt is "nil" then continue on a Nil can be a press. (setq 1pnt (getreal "\nEnter pt num or press <Cr. to exit) (if (/= 1pnt nil) (prong (setq 2pnt (getreal "\nEnter Pt num")) (Command "Line" "'pn" 1pnt 2pnt "") ; note "" is same as command ) ) "" and (command) aren't the same thing. They act differently depending on which situaion you are in. J, did you test this: (command "line" "'PN" 1pnt 2pnt)(command) 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.