Jump to content

Cancelling out transparent Civil command within LISP


Recommended Posts

Posted

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.

Posted

Check out Lee's tutorial on Error handling here

 

This should help you ESC out of commands without much issue.

Posted
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.

Posted
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.

Posted

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")

Posted

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.

Posted
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.

Posted
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)

Posted

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 
)
)

Posted
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...

Posted
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.

Posted
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)

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...