• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Discussion Groups

    AutoCAD Electrical

    Reply
    Valued Contributor
    Posts: 77
    Registered: ‎04-24-2012
    Accepted Solution

    OSNAP/OSMODE LISP ROUTINE

    384 Views, 4 Replies
    06-27-2012 09:16 AM

    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)

    Please use plain text.
    *Expert Elite*
    Posts: 979
    Registered: ‎03-09-2004

    Re: OSNAP/OSMODE LISP ROUTINE

    06-27-2012 11:19 AM 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
    Please use plain text.
    Valued Contributor
    Posts: 77
    Registered: ‎04-24-2012

    Re: OSNAP/OSMODE LISP ROUTINE

    06-27-2012 11:38 AM 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

    Please use plain text.
    *Expert Elite*
    Posts: 979
    Registered: ‎03-09-2004

    Re: OSNAP/OSMODE LISP ROUTINE

    06-27-2012 12:09 PM 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
    Please use plain text.
    Valued Contributor
    Posts: 77
    Registered: ‎04-24-2012

    Re: OSNAP/OSMODE LISP ROUTINE

    06-27-2012 12:24 PM 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

    Please use plain text.