Menu Item Repeat

Discussion in 'AutoCAD' started by TRJ, Apr 6, 2005.

  1. TRJ

    TRJ Guest

    I have a partial menu (heirarchical) with hundreds of lines like the
    following:

    [SP-20 ]^c^c-LAYER;M;LA-TREE;C;3;;;-INSERT;TREE-01;\(/ 10.0 12)+
    ;;;SP-20;-LAYER;M;LA-TREEHT;C;2;;;-INSERT;TREE-HGT;@;!sf;;;20;

    How can these macro be "defun'd" so that a single return will repeat the
    macro? I know how to make macros repeat but this is not the desired
    functionality.
     
    TRJ, Apr 6, 2005
    #1
  2. TRJ

    Tom Closs Guest

    It looks as if all of these macros creates some layers and inserts blocks on
    these layers. If you created a simple LISP routine to do the same thing it
    would allow you to use the Enter key to repeat the LISP lika a seperate
    AutoCAD command. I think this is what you are looking for.
     
    Tom Closs, Apr 6, 2005
    #2
  3. TRJ

    Casey Guest

    for toolbar buttons, putting a '*' before the command makes it repeat untill
    it is 'escaped' out of..... don't know if it works in a menu or not....
    probably not... so Lisp would be the way to go.

    Casey
     
    Casey, Apr 6, 2005
    #3
  4. TRJ

    TRJ Guest

    If I create a subroutine and call it in each macro with the appropriate
    values as in:

    [TAF]^c^c(gcvr_sub "TAF" 12)

    it DOES NOT repeat with a simple Enter.

    I cannot imagine having to create unique C: defuns for each line of the menu
    (hundreds of lines). And as stated before, I realize a menu macro can be
    made to repeat until escaped but, again, this is not the desired
    functionality.

    Can't you create a "container" or temporary C: defun of some sort to
    accomplish the desired functionality? Is the lambda function what I'm
    looking for? I've never used it nor do I understnd its use.


     
    TRJ, Apr 7, 2005
    #4
  5. TRJ

    Jeff Mishler Guest

    How about this?
    [TAF]^c^c(defun c:temp () (gcvr_sub "TAF" 12));temp
    [TAM^c^c(defun c:temp () (gcvr_sub "TAM" 10));temp

    etc.......


    --
    Jeff
    check out www.cadvault.com
     
    Jeff Mishler, Apr 7, 2005
    #5
  6. TRJ

    TRJ Guest

    Tadah - where do I send the prize money ;-). Thanks Jeff for a glimpse of
    sanity!

     
    TRJ, Apr 7, 2005
    #6
  7. The * alone isn't enough -- the menu item needs to start with *^C^C. And
    it does work in tablet, screen, and pull-down menus as well as toolbars.
    --
    Kent Cooper

     
    Kent Cooper, AIA, Apr 7, 2005
    #7
  8. TRJ

    Tom Smith Guest

    I've used your basic idea of doing a c: defun to make a menu itme repeat with a return, but with image menus. For instance we have a menu of common drawing tags, and it's common to place a bunch of them in a series. So the image_tags menu is called indirectly from a pulldown by

    [Drawing Tags]$I=ourmenu.image_tags imagemenu;

    Or from a toobar button by

    [_Button("Tags", "tags.bmp", "tags.bmp")]$I=ourmenu.image_tags imagemenu;

    And in the associated mnl there's a c: function

    (defun c:imagemenu ()
    (menucmd "I=*")
    (princ))

    This is enough to make the image menu pop up again by hitting a return.

    You could simplify Jeff's approach one step further by having a function in your mnl like

    (defun dothis (functioncall)
    (setq c:temp (list nil functioncall))
    (c:temp))

    And then the menu item would reduce to

    [TAF]^c^c(dothis '(gcvr_sub "TAF" 12));

    That would eliminate all those repetitive defuns in the menu itself.
     
    Tom Smith, Apr 7, 2005
    #8
  9. TRJ

    TRJ Guest

    Excellent advice gentlemen. thank you.

    with a return, but with image menus. For instance we have a menu of common
    drawing tags, and it's common to place a bunch of them in a series. So the
    image_tags menu is called indirectly from a pulldown by
     
    TRJ, Apr 7, 2005
    #9
  10. TRJ

    Tom Smith Guest

    Oops, not that it really matters, but I should have declared the on-the-fly defun local:

    (defun dothis (functioncall / c:temp)
    (setq c:temp (list nil functioncall))
    (c:temp))
     
    Tom Smith, Apr 7, 2005
    #10
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.