Transparent -osnap?

Discussion in 'AutoCAD' started by Gordon Price, Jan 13, 2005.

  1. Gordon Price

    Gordon Price Guest

    I am looking to do a transparent osnap in a menu macro. I don't want just a
    temporary osnap override, but rather a change in running osnaps that can be
    done mid command.

    Thus far I have found no mention of specifically making a menu macro
    transparent. I know ^C^C will kill a command, so I of course have ditched
    that, but [End, mid, int]-osnap End,Mid,Int isn't doing it. I am thinking
    that doing this via the -osnap command is a problem, but I am not sure of
    another approach.

    Any suggestions?

    Thanks in advance,
    Gordon
     
    Gordon Price, Jan 13, 2005
    #1
  2. Gordon Price

    T.Willey Guest

    I'm not that familar with menu macros, but in lisp if you know the number value you want, you do

    (setvar "osmode" <number here>)

    Tim
     
    T.Willey, Jan 14, 2005
    #2
  3. Gordon Price

    T.Willey Guest

    Could you do a 'osnap to make it transparent? Works when typed at the command line.

    Tim
     
    T.Willey, Jan 14, 2005
    #3
  4. Gordon Price

    Gordon Price Guest

    I think thats it. I just couldn't find the reference under menu macros,
    because the reference was under the command line in the help. Got a show to
    do, so I will try that tomorrow. Thanks!

    Gordon
     
    Gordon Price, Jan 14, 2005
    #4
  5. Gordon Price

    Tom Smith Guest

    Gordon, without testing I think Tim's right, but then you're going to have
    to reset osmode at the end of the macro too, I'd assume. Personally I'm
    probably make it a lisp function, put it in an mnl, and call the lisp from
    the menu. When you get into these kinds of things -- setting a var, doing
    things, then resetting the var -- it begins to be more than I want to put in
    an inline menu macro.
     
    Tom Smith, Jan 14, 2005
    #5
  6. Gordon Price

    Dommy2Hotty Guest

    Here is how the menu macro should look for what you're trying to accomplish:
    Code:
    ^C^C^C(setq oldsnaps (getvar "osmode"));(setvar "osmode"  163);THE REST OF YOUR MACRO HERE;(setvar "osmode" olsnaps);
     
    Dommy2Hotty, Jan 14, 2005
    #6
  7. Except it won't be transparent that way. If it should be, leave out the
    ^C^C^C. [And put the d back into oldsnaps near the end.]
     
    Kent Cooper, AIA, Jan 14, 2005
    #7
  8. Gordon Price

    Tom Smith Guest

    [End, mid, int]-osnap End,Mid,Int isn't doing it ...

    Gordon, on re-reading, apparently I misunderstood, sorry.

    Judging by your label, if the purpose of the macro is simply to change
    running osnaps and no more, then you can do that transparently by

    '_osnap;end,mid,int;

    You can also do the same thing with

    (setvar "osmode" 35);

    The lisp expressioon is transparent without an apostrophe.
     
    Tom Smith, Jan 14, 2005
    #8
  9. Gordon Price

    Tom Smith Guest

    Here is how the menu macro should look for what you're trying to
    accomplish:
    YOUR MACRO HERE;(setvar "osmode" olsnaps);

    On a second reading, I don't think that's what he's after. Note that he
    labeled the macro [End, mid, int] so apparently there isn't anything else to
    be done.

    But as I noted earlier, if there were other things to be done, this is more
    lisp than I would put in a menu macro. I'd put the whole business in a defun
    in the mnl and just call that function. For the usual reasons -- it's a lot
    easier to debug a lisp, with VLIDE or whatever, than it is to
    unload/reload/test/edit a menu in order to get the thing working. It's also
    easier to maintain, for the same reasons, and it keeps your menus short and
    sweet when you don't have all that inline code. I'd much rather see

    ^c^c(mycoolmacro);

    where that function is defined in the mnl.

    Other considerations ... this will leave oldsnaps as a dangling global
    variable unless you add yet more code to null it out at the end of the
    macro. Maybe not a big deal in itself, but if you get in the practice of
    leaving variables dangling, sooner or later you'll find things are getting
    mysteriously buggy all over the place. Also, since your example seems
    intended to have the user make a selection, note that it will leave osmode
    changed if the user cancels, and he/she will have plenty of time to do that
    at the selection prompt. So to reset osmode on cancel, you'd have to add
    even more code, an error handler, but whoops! you're not gonna be able to
    make the error handler local in the macro because you're not defining a
    function. One thing leads to another. IMHO lisp is best done in a lisp file
    and just called from a menu macro.
     
    Tom Smith, Jan 14, 2005
    #9
  10. Gordon Price

    Gordon Price Guest

    Tom, et. al.,
    thanks for the info. Indeed the apostrophe was the missing element. As you
    surmised, my goal is simply to reset the running osnaps, either before a
    command or in one. I have some routines that set osnap and then restore it,
    used for specific block inserts and such, and I have harped on perhaps
    getting osnap settings per Tool in ToolPalettes as a nice upgrade, but in
    this case I have simply added three 'standard' running osnap settings to my
    pop0 menu. This way, when for a few commands I just need endpoints, and then
    want to go back to my idea of ideal general use running snaps, it is a
    single pick each time, rather than going to the dialog, turning all off and
    endpoints on, then going back again later and multipicking to get back to my
    general use settings. I have been doing this for a while, but not
    transparently, and I have noticed that I sometimes realize mid command that
    I need a different running osnap environment. Canceling the command,
    changing the osnap environment, then starting the command again just seemed
    like something that could be avoided. Thus...

    ID_aCOsnapsSTD [Standard Osnaps]^P'-osnap End,Mid,Cen,Node,Quad,Int,Ins
    ID_aCOsnaps_1 [End, mid, int]^P'-osnap End,Mid,Int
    ID_aCOsnaps_2 [End only]^P'-osnap End

    Seems to work like a charm.

    Best,
    Gordon
     
    Gordon Price, Jan 14, 2005
    #10
  11. Gordon Price

    Tom Smith Guest

    I have simply added three 'standard' running osnap settings to my pop0
    menu

    Sounds handy, thanks for posting back. At one point we had one-letter
    keyboard macros to do the same thing. They faded from popularity, though,
    probably because it's such an area of personal preference and drafting
    approach.

    The guy who had designed them had three favorite osmode settings, and
    claimed you'd never need any other. But actually most other people had their
    own faves. Then F3 came along, and everybody was happy. Turned out that the
    majority of osmode changes consisted of toggling the user's main favorite
    setting off & on. A few people have a secondary favorite which they've put
    on a toolbar button, similar to your macros.
     
    Tom Smith, Jan 14, 2005
    #11
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.