AllExperts > AutoCAD 
Search      
AutoCAD
Volunteer
Answers to thousands of questions
 Home · More AutoCAD Questions · Answer Library  · Encyclopedia ·
More AutoCAD Answers
Question Library

Ask a question about AutoCAD
Volunteer
Experts of the Month
Expert Login

Awards

About Us
Tell friends
Link to Us
Disclaimer

 
 
 
 
About Scott Cook
Expertise
I`ve been using AutoCAD since 1987 and programming AutoLISP nearly as long. I can answer questions about programming AutoCAD (except ARX) and production enhancement techniques. I cannot answer questions about AutoCAD crashes or DWG corruption. AutoCAD PROGRAMMING (menus, lisp) related questions only!

Experience
Since 1987. Author of Plot2000 software for for AutoCAD, http://www.plot2000.com. PROGRAMMING QUESTIONS ONLY PLEASE. Questions that are NOT related to programming or AutoCAD customization (menus and lisp only please) are outside the scope of my volunteer services and will NOT BE ANSWERED.
 
   

You are here:  Experts > Computing/Technology > Computer-Aided Design > AutoCAD > Lisp - osnap

AutoCAD - Lisp - osnap


Expert: Scott Cook - 11/10/2003

Question
Hi!

I'm having problems with osnap. In my lisp script i would like to turn the osnap off and then turn it on but it must be the same as before, all functions must remain as before (example Endpoint, Circle...). Ok, i figured that out that i can help myself with osmode and number, but my script should be independent cause it will be used by many people, so i can't help myself with osmode. I'm wondering, is there maybe a way to run "F3" by script command (that just swiches osnap on and off)? Any other ideas maybe? Thank you in advance.

Answer
this is done by saving the value of osmode at the beginning of your routine and restoring it at the end.
put this at the beginning of your routine, after the defun
(setq old-osmode (getvar "osmode"))

then before the end of your routine put this:
(setvar "osmode" old-osmode)

you will eventually need to read up on the *error* function which will allow you to do this even if someone presses cancel to get out of your routine.


Add to this Answer    Ask a Question



  Rate this Answer
   Was this answer helpful?
Not at allDefinitely              
   12345  

     
About Us | Advertise on This Site | User Agreement | Privacy Policy | Help
Copyright  © 2008 About, Inc. About and About.com are registered trademarks of About, Inc. The About logo is a trademark of About, Inc. All rights reserved.