AutoCAD Electrical General Discussion

AutoCAD Electrical General Discussion

Reply
Distinguished Contributor
acade2012
Posts: 116
Registered: ‎04-24-2012
Message 1 of 5 (903 Views)
Accepted Solution

OSNAP/OSMODE LISP ROUTINE

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

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

*Expert Elite*
testsubject
Posts: 1,096
Registered: ‎03-09-2004
Message 2 of 5 (895 Views)

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
Distinguished Contributor
acade2012
Posts: 116
Registered: ‎04-24-2012
Message 3 of 5 (892 Views)

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

*Expert Elite*
testsubject
Posts: 1,096
Registered: ‎03-09-2004
Message 4 of 5 (887 Views)

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
Distinguished Contributor
acade2012
Posts: 116
Registered: ‎04-24-2012
Message 5 of 5 (884 Views)

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

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Need installation help?

Start with some of our most frequented solutions to get help installing your software.

New AutoCAD Electrical Category!

The AutoCAD Electrical forum has moved into it's very own category page, and can no longer be found within the Additional Product Forums.

Announcements
Manufacturing Community
The Manufacturing Community provides additional access to tips, tutorials, blogs and networking with peers.