Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getpoiint in AutoLisp - Can I use Osnap??? 1

Status
Not open for further replies.

j18wheeler

Technical User
Feb 25, 2004
2
US
Without setting Osnap using osmode, is there a way to set a temporary value for osnap? i.e. (getpoint "cen") for cen of?

my problem is my Osnaps keep getting reset and if I use the osmode I cannot return to my basic settings when cancelling out of a while loop.

I can manually type "cen" in the command line during the function but I cannot seem to figure out how to get Lisp to enter that for me.
 
You could filter the point after getting the user selected point with 'osnap', such as (setq PtCen (osnap pt1 "cen")). Or you could use an error routine within your lisp that restores osnaps after cancelling, which is good practice. IsYou might also set up your while loop to exit cleanly with a [return].
 
(setq PtCen (osnap pt1 "cen"))

then?
(setq pt1 (getpoint "\nPick first circle"))???

I'm setting it up to draw lines between nodes. click click click etc until Im done then cancel out... How would an error routine look? I'm pretty new to this stuff and am actually updating an existing .lsp file to work slightly better.
 
If you can modify the routine to not have to escape, you can have the lisp set osnap before the point selection and reset it after. You *probably* can modify the while loop to be something lige:

(while (setq pt (getpoint "\nSelectPoint:"))
(some stuff here)
);end while

which causes the while loop to end cleanly when user hits return/enter.

The 'osnap' function acts on a previously set/defined point, so it's the reverse order you showed. You wouldn't get a "cen" snap marker on selection this way.

And for error routine/trapping, it's too long to discuss here, see the tutorial at
Hope this helps!
anset the
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top