See the top rated post in this thread. Click here

Page 1 of 2 12 LastLast
Results 1 to 10 of 16

Thread: Can you turn off OSNAP from inside Macros?

  1. #1
    Active Member
    Join Date
    2004-10
    Location
    Tampa
    Posts
    52
    Login to Give a bone
    0

    Question Can you turn off OSNAP from inside Macros?

    Hello Everyone. I have been creating specialized tool buttons ever since I absorbed all the information from Lynn Allen's "Menu Madness". Now I have come to a brick wall. I have a habit of forgetting to shut my osnap off before using my Stretch with crossing polygon button. All I want to do is shut off osnap with in the Macro. Lisp isn't really an option right now. I'll start learning about that this summer. I love the LISP routines I have right now, but I don't know how to write them yet.

    Thank You in advance for your help.
    Adam

  2. #2
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Can you turn off OSNAP from inside Macros?

    Hi

    You could look at using the OSnap "None" option ie.

    Code:
    Command: _.Stretch
     
     Select objects to stretch by crossing-window or crossing-polygon...
     Select objects: Specify opposite corner: 2 found
     
     Select objects:
     
     Specify base point or displacement: _None
     
     Specify second point of displacement or <use first point as displacement>: _None
     
     Command:
    Have a good one, Mike

  3. #3
    Active Member
    Join Date
    2004-10
    Location
    Tampa
    Posts
    52
    Login to Give a bone
    0

    Default Re: Can you turn off OSNAP from inside Macros?

    Thank You for your help Mike. I was able to use the _non selection in the Macro only once, and since I'm using the polygon option then there are sometimes several selection clicks. Now I'm at the point where the Osnaps are not active for just the first selection. Is there a way to have the _non selection active until the command is exited?

    Thanks Again,
    Adam

  4. #4
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Can you turn off OSNAP from inside Macros?

    Hi

    Maybe use a tiny bit of LISP....

    Code:
    (setq Saved_OSMode (getvar "OSMode))
     (setvar "OSMode" 0)
     Do your stuff....
     (setvar "OSMode" Saved_OSMode)
    Have a good one, Mike
    Last edited by Mike.Perry; 2005-04-15 at 09:08 PM. Reason: Correct poor grammar.

  5. #5
    Active Member
    Join Date
    2004-10
    Location
    Tampa
    Posts
    52
    Login to Give a bone
    0

    Default Re: Can you turn off OSNAP from inside Macros?

    Ok, please dont start throwing things at me for this. Do I just insert that LISP into the Macro for the toolbar?

  6. #6
    Certified AUGI Addict jaberwok's Avatar
    Join Date
    2000-12
    Location
    0,0,0 The Origin
    Posts
    8,570
    Login to Give a bone
    0

    Default Re: Can you turn off OSNAP from inside Macros?

    To toggle all snaps OFF -

    (setq osm (getvar "osmode")) (setvar "osmode" (+ osm 16384))

    To return to previous snap settings -

    (setvar "osmode" (- osm 16384))

    The last bit should work but it's giving me problems at the moment.

    HTH

  7. #7
    I could stop if I wanted to pnorman's Avatar
    Join Date
    2005-02
    Location
    Calgary
    Posts
    203
    Login to Give a bone
    0

    Smile Re: Can you turn off OSNAP from inside Macros?

    Hi arobitaille,

    If you include an example of one of your macros in your post it would help people a lot in determining the best way to answer your question.
    With several different languages to choose from and many people at different levels its good to know where you're coming from. There's always more than one way to solve a problem but its about offering the most efficient for your needs!

    Cheers
    P

  8. #8
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Can you turn off OSNAP from inside Macros?

    Quote Originally Posted by arobitaille
    Ok, please dont start throwing things at me for this. Do I just insert that LISP into the Macro for the toolbar?
    Hi

    No one is going to do such a thing....

    As "pnorman" suggested, post what you have so far, we can then go from there.

    Have a good one, Mike

  9. #9
    Active Member
    Join Date
    2004-10
    Location
    Tampa
    Posts
    52
    Login to Give a bone
    0

    Default Re: Can you turn off OSNAP from inside Macros?

    OK, This is what I have in the toolbar Macro: ^C^Cstretch;cp;_non.
    I can't seem to repeat the _non selection for each polyline selection. Any help here is appreciated.

    Thanks Again,
    Adam

  10. #10
    I could stop if I wanted to pnorman's Avatar
    Join Date
    2005-02
    Location
    Calgary
    Posts
    203
    Login to Give a bone
    0

    Default Re: Can you turn off OSNAP from inside Macros?

    Here is one way to do it;

    change the button macro to this:
    ^C^Caro_str;

    paste this into your acaddoc.lsp

    (defun c:aro_str ()
    (setvar "osmode" (+ (getvar "osmode") 16384))
    (command "stretch" "cp")
    (while (= (logand 1 (getvar "cmdactive")) 1)
    (command pause)
    )
    (setvar "osmode" (- (getvar "osmode") 16384))
    (princ)
    )

    The command c:aro_str will be available when you next open a drawing.
    WARNING: there is no error handling built in. If you hit Esc half way through your osnaps will not be reset. With more time I can make it smarter! (you can turn them back on using the "osnap" tab at the bottom of your screen)

    PS You can change c:aro_str to whatever you want!
    Last edited by pnorman; 2005-04-19 at 03:17 PM.

Page 1 of 2 12 LastLast

Similar Threads

  1. 2014: DWG Nested Inside Detail Comp. > Nested Inside Profile > Nested Inside Window
    By edu.rocha.tavares in forum Revit Architecture - Families
    Replies: 5
    Last Post: 2013-11-26, 06:46 PM
  2. osnap will not turn off
    By bowtle in forum AutoLISP
    Replies: 13
    Last Post: 2013-09-16, 09:43 PM
  3. Macros
    By christopher.r.schroll in forum VBA/COM Interop
    Replies: 2
    Last Post: 2009-02-13, 04:51 PM
  4. Replies: 5
    Last Post: 2007-04-26, 07:19 PM
  5. Ability to turn OFF X-Clip command inside a Floating Viewport?
    By bpurdie in forum AutoCAD Customization
    Replies: 0
    Last Post: 2006-03-16, 08:24 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •