AutoCAD Electrical Forum
Welcome to Autodesk’s AutoCAD Electrical Forums. Share your knowledge, ask questions, and explore popular AutoCAD Electrical topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

OSNAP/OSMODE LISP ROUTINE

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
acade2012
3722 Views, 4 Replies

OSNAP/OSMODE LISP ROUTINE

Hello All

 

I am having an issue with a lisp routine that sets a drawing to a set of defaults. I.E. zooms to extents,ortho on grid off ETC

 

I have the routine work all but the osnaps/osmode.

 

I can add the osnaps i want by listing them but i cannot add the apparent intersection osnap. the routine doesnt like the space. i tried an underscore, i tried no space, i tried just "apparent" with no success.

 

I went another route on setting the osmode to the number i wanted "31671" but the osnaps are not turned on after that.

 

i have also tried to turn on the osnaps with      (command "._osnap" "on") after the osmode command no luck there either.

 

It doesnt matter which was I do it as long as it comes out with the desired osnaps on and theey are enabled.

 

below is the code i am using

 

thanks for any help

 

;Resets Default Drawing Settings      

(prompt "\nType DDS-12 to run.....")

 

(DEFUN C: DDS-12 ()

 

;;Function sets default linetype, lineweight and color to bylayer

 

(command "._-LINETYPE" "S" "BYL" "")

(command "._-LWEIGHT" "BYL")  

(command "._-COLOR" "BYL")

 

;;Function sets listed items to desired default settings

 

(command "._LWDISPLAY" "OFF")  

(command "._ortho" "ON")  

(command "._GRID" "OFF")

(command "._ZOOM" "E")  

 

(command "._osmode" "31671")    

or

(command "._OSNAP" "MIDPOINT,NEAREST,ENDPOINT,QUADRANT,INTERSECTION" "") 

  

(command ".-LAYER" "m" "DefPoints" "c" "250" "" "s" "0" "")        

(command "SNAPUNIT" "0.0625,0.0625")  

(setvar "sdi" 1)

(setvar "filedia" 1)

 

);defun

 

(princ)

4 REPLIES 4
Message 2 of 5
testsubject
in reply to: acade2012

You had a typo in the defun statement (I removed the space between "C:" and "DDs-12" and the two double quotes at the end of the Osnap was attempting to start the app again.

 

As is, it worked for me (ACE 2013).

 

I did not check every setting, just the Osnaps.

 

;Resets Default Drawing Settings      

(prompt "\nType DDS-12 to run.....")

 

(DEFUN C:DDS-12 ()

 

;;Function sets default linetype, lineweight and color to bylayer

 

  (command "._-LINETYPE" "S" "BYL" "")

  (command "._-LWEIGHT" "BYL")  

  (command "._-COLOR" "BYL")

 

  ;;Function sets listed items to desired default settings

 

  (command "._LWDISPLAY" "OFF")  

  (command "._ortho" "ON")  

  (command "._GRID" "OFF")

  (command "._ZOOM" "E")  

 
  (command "._OSNAP" "MIDPOINT,NEAREST,ENDPOINT,QUADRANT,INTERSECTION") 

  
  (command ".-LAYER" "m" "DefPoints" "c" "250" "" "s" "0" "")        

  (command "SNAPUNIT" "0.0625,0.0625")  

  (setvar "sdi" 1)

  (setvar "filedia" 1)

 

);defun

 



Bob Hanrahan
Ace User since 1998
If this answered your question, please click on "Accept Solution"
Message 3 of 5
acade2012
in reply to: testsubject

THANKS FOR YOUR INPUT

 

YEAH I KNEW ABOUT THE SPACE BETWEEN THE C; AND DDS BUT I DIDNT WANT IT TO SHOW A SMILIE FACE THERE GOOD CATCH!!!

 

BUT MY PROBLEM STILL EXISTS IN THAT I CANNOT ADD THE APPARENT INTERSECTION COMMAND TO THE OSNAP.

 

ANY IDEA OF WHAT IT NEEDS TO BE CALLED TO ADD IT TO THE ROUTINE THAT WAS MODIFIED?

 

THANKS AGAIN FOR YOUR HELP

Message 4 of 5
testsubject
in reply to: acade2012

That is what I get for not thoroughly reading the post.

 

To get the Apparent Intersection just add "APP" (this is the 3 letter shortcut for Apparent Intersection.)



Bob Hanrahan
Ace User since 1998
If this answered your question, please click on "Accept Solution"
Message 5 of 5
acade2012
in reply to: testsubject

THANKS

 

I TRY TO PUT WHAT I HAVE TRIED TO DO SO IT TENDS TO BE A LONG POST

 

JUST TRYING NOT TO HAVE REPLIES TO SOMETHING I HAVE ALREADY TRIED

 

JUST TRYING TO BE THROUGH!!

 

IT WORKED GREAT

 

THANKS AGAIN FOR YOUR HELP

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost