View Full Version : My Own Ortho Mode toggle, to be used transparently
thebatman_
2006-08-05, 06:07 AM
Is there a way to transparently evoke a lisp routine without the return value interrupting the command in progress?
I'm trying to program my own orthomode on/off button. Here's the lisp code:
(defun C:ortogg ()
(if (= 0 (getvar "ORTHOMODE"))
(setvar "ORTHOMODE" 1)
(setvar "ORTHOMODE" 0)
)
)The button macro which evokes it is simple: 'ortogg
...but, the function's return value interrupts the active command. For example, with the LINE command, this happens:
Command: _line
Specify first point: 'ortogg
1
Specify next point or [Undo]:
The "1" was returned by the function so now the LINE command waits for input for the second point.
I'm using ADT 2006. Any suggestions?
[ Moderator Action = ON ] What are [ CODE ] tags... (http://forums.augi.com/misc.php?do=bbcode#code) [ Moderator Action = OFF ]
Mike.Perry
2006-08-05, 06:16 AM
Hi
Try adding a princ statement...
(defun C:ortogg ()
(if (= 0 (getvar "ORTHOMODE"))
(setvar "ORTHOMODE" 1)
(setvar "ORTHOMODE" 0)
)
(princ) ; Added princ statement.
)Have a good one, Mike
thebatman_
2006-08-05, 06:55 AM
Thanks! I'm buying lunch next time! ;)
Tom Beauford
2006-08-10, 08:35 PM
I've always had an Ortho button, but to avoid conflicts with lisp routines already running don't use lisp with commands you want to use transparently.
For the Ortho command: ^O
The Ortho.bmp no longer comes with Autocad, but drop me a line at my email address below and I'll send it to you if you want it.
For trickery ones like turning the command line on/off use a diesel expression:
$M=$(if,$(and,$(>,$(getvar,clistate),0)),_commandlinehide,_commandline)
For the Image use: RCDATA_16_COMMANDLINE
It's a reference to the acadbtn.xmx file where most of the ones Autocad uses are kept.
kennet.sjoberg
2006-08-10, 08:51 PM
Why not use the [ F8 ] key ?
<Ortho on> / <Ortho off>
: ) Happy Computing !
kennet
gbraate
2009-09-24, 05:16 PM
I've boon looking for this line for days. Now to figure out how to make it run every time ACAD.exe starts.
For trickery ones like turning the command line on/off use a diesel expression:
$M=$(if,$(and,$(>,$(getvar,clistate),0)),_commandlinehide,_commandline)
For the Image use: RCDATA_16_COMMANDLINE
It's a reference to the acadbtn.xmx file where most of the ones Autocad uses are kept.
Thank you, thank you, thank you.
RobertB
2009-09-24, 05:47 PM
$M=$(if,$(and,$(>,$(getvar,clistate),0)),_commandlinehide,_commandline)
I've boon looking for this line for days. Now to figure out how to make it run every time ACAD.exe starts.You don't want this to run every time you start AutoCAD, because your command line will flip every time you start AutoCAD.
Do you mean "how to make it load every time"? To get it loaded, add a CUI command and add the command to one of the CUI interface elements.
gbraate
2009-09-24, 05:56 PM
Yes, the task is to make the command line obsolete. Thank you. Got any code up your sleeve?
surfing on Opera 10
searching with BING
alanjt
2009-09-24, 06:26 PM
(defun c:OrTogg (/)
(setvar "orthomode" (abs (1- (getvar "orthomode"))))
(princ)
)
RobertB
2009-09-24, 11:27 PM
Yes, the task is to make the command line obsolete. Thank you. Got any code up your sleeve?Probably not a good idea, unless they have fixed the performance issues with an undocked command line window.
Dynamic input is not complete enough to discard the command line window.
(You do know that you can drag the docked command line off the application and float it as a palette, right?) :shock:
gbraate
2009-09-25, 08:35 PM
Probably not a good idea, unless they have fixed the performance issues with an undocked command line window.
Dynamic input is not complete enough to discard the command line window.
(You do know that you can drag the docked command line off the application and float it as a palette, right?) :shock:
Thanks RobertB, I'm enjoying the conversation.
My actual ambition is to just have the command line hidden on the initial startup for the true affect of leaving it behind; thus leaving room for the Ribbon (the new technology). I'm sure that the end-users will find, and bring it back. :cry:
RobertB
2009-09-25, 10:24 PM
Thanks RobertB, I'm enjoying the conversation.
My actual ambition is to just have the command line hidden on the initial startup for the true affect of leaving it behind; thus leaving room for the Ribbon (the new technology). I'm sure that the end-users will find, and bring it back. :cry:The Ribbon is not a replacement for the command-line. It is the true replacement of the Dashboard, and a possible replacement of the Menus and Toolbars. (And some would say it is not much of a replacement for menus or toolbars.)
Add this to your Acad.lsp (NOT Acad20xx.lsp!):
(if (= (getvar 'CLIState) 1) (command "._CommandLineHide"))
But personally, from the perspective of the user, you better not be forcing my interface in such a fashion. I think you will have a revolt if you do this.
howardjosh
2009-09-28, 09:54 AM
I didn't see anything about vlax-add-cmd in a thread about transparent commands.... So thought I'd throw this in
(vl-load-com)
(defun ortog ()
(if (= (getvar "orthomode") 1)
(setvar "orthomode" 0)
(setvar "orthomode" 1)
)
)
(vlax-add-cmd "ort" 'ortog "ort" 1)
NOTE: Command Line = Best Friend and Ally
RobertB
2009-09-28, 05:44 PM
I didn't see anything about vlax-add-cmd in a thread about transparent commands.... So thought I'd throw this in
(vl-load-com)
(defun ortog ()
(if (= (getvar "orthomode") 1)
(setvar "orthomode" 0)
(setvar "orthomode" 1)
)
)
(vlax-add-cmd "ort" 'ortog "ort" 1)
NOTE: Command Line = Best Friend and Ally<'> + <O> + <R> + <T> + <Enter> = 5 keystrokes
<F8> = 1 keystroke
<Left Shift> = 1 keystroke
I fail to see the advantage to your approach.
alanjt
2009-09-29, 01:01 AM
You can call that routine transparently w/o the use of vlax-add-cmd.
I agree w/Robert, why all the fuss over a orthomode toggle, when F8 and holding the shift key down exist.
I didn't see anything about vlax-add-cmd in a thread about transparent commands.... So thought I'd throw this in
(vl-load-com)
(defun ortog ()
(if (= (getvar "orthomode") 1)
(setvar "orthomode" 0)
(setvar "orthomode" 1)
)
)
(vlax-add-cmd "ort" 'ortog "ort" 1)NOTE: Command Line = Best Friend and Ally
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.