Repeating menu commands with MULTIPLE
Trying to get a menu from AutoCAD running in BricsCAD I noticed that the MULTIPLE command doesn't do what I expected. The theory is about a hammer and some nails: You grab the hammer and and punch all nails in wood instead of laying down the hammer, processing one nail, laying down the hammer, etc. Analogue you grab the circle command and keep drawing circles until you're finished. In AutoCAD this is achieved by starting a menu-item with an asterisk or the multiple command like this: *^c^circle;
I know that an empty return solves this because it repeats the last command but this is not always what is wanted. For example, the following simulates an AutoCAD LT align command - or if you wish a BricsCAD 2d-align command - where an extra return does not repeat the button macro and offers you an unwanted command.
*^C^C_select;\_move;_p;;\\_rotate;_p;;@0,0;_reference;@;
Is it possible to make these kind of command strings repetitive?
I know that an empty return solves this because it repeats the last command but this is not always what is wanted. For example, the following simulates an AutoCAD LT align command - or if you wish a BricsCAD 2d-align command - where an extra return does not repeat the button macro and offers you an unwanted command.
*^C^C_select;\_move;_p;;\\_rotate;_p;;@0,0;_reference;@;
Is it possible to make these kind of command strings repetitive?
0
Comments
-
The asterisk does work on BricsCAD.
This works:
*^c^c_circle;\\
But this does not (BC gets caught in a loop):
*^c^c_circle;
So your problem boils down to debugging your macro (which may have worked on AC).
This works for me:
*^c^c_select;\_move;_p;;\\_rotate;_p;;@;_reference;@;\\
Note:
There is also a _MULTIPLE command:
^c^c_multiple;_circle;
And of course quite a few commands have a built-in multiple option.0 -
Roy, thanks for the helpful (and prompt!) reply. It solves 95% of my issues. Only problem will be in situations where input is not fixed and the amount of backslashes is variable. A big step closer to a successful port.0
-
In some cases using Lisp may work.
[code](while T
(command "_circle")
(while (> (getvar 'cmdactive) 0)
(command pause)
)
)
[/code]
Note that the outer while loop can only be exited using the Escape key, which will cause a Lisp error. So if you use the code in a Lisp function and change certain variables inside the function you will need to use good error handling to reset them.0 -
Thank guys ! This * solves one of my issues of repetitiv insert of blocks disscussed here http://forum.bricsys.com/discussion/8254 wich was half way solved here http://forum.bricsys.com/discussion/19151 .
Needed a bit of fiddling around with the slashes though. This is getting me a bit closer to leaving V7.
Patrik
0 -
Roy, thanks, it did point me in the good direction... and probably Patrick too.
If I understand correctly Patrick wants to right click to enter and repeat the last command. The construction with \ is tricky because you need to know exactly how much back slashes are needed - choosing a command option ruins your counts - where the pause option simply waits until the command is finished. Putting the code in on_doc_load.lsp as
[code]
(defun c:lspcircle ()
(while T
(command "_circle")
(while (/= (getvar 'cmdactive) 0)
(command pause)
)
)
)
[/code]
... makes it right click-able because the c: defines lspcircle as a command. Cmdecho on shows the command on the cli.
A menu item like:
[code]
[_Button("Circle", "circle.bmp", "circle.bmp")]^c^clspcircle;
[/code]
does the job and doesn't crash BricsCAD when the circle button is hit twice.
Now some time to transform the menu ... :-)0
This discussion has been closed.