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