Author Topic: define accelarator keys using lisp  (Read 8051 times)

0 Members and 1 Guest are viewing this topic.

ronjonp

  • Needs a day job
  • Posts: 7529
define accelarator keys using lisp
« on: August 09, 2006, 05:39:57 PM »
Is there a way to define accelarator keys using lisp? Like changing F4 to a snap?

thanks,

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Patrick_35

  • Guest
Re: define accelarator keys using lisp
« Reply #1 on: August 10, 2006, 04:21:04 AM »
Hi
Yes, you can use or look the lisp aliasedit from expresstools

@+

LE

  • Guest
Re: define accelarator keys using lisp
« Reply #2 on: August 10, 2006, 09:26:21 AM »
Is there a way to define accelarator keys using lisp? Like changing F4 to a snap?

As far as I know - nope -

ronjonp

  • Needs a day job
  • Posts: 7529
Re: define accelarator keys using lisp
« Reply #3 on: August 10, 2006, 11:27:50 AM »
Darn.

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
Re: define accelarator keys using lisp
« Reply #4 on: August 10, 2006, 06:12:15 PM »
No sarcasim (I am drop dead serious): This is a wonderfull post Ron! Outstanding subject title, clean/clear question, overall nice in tone...Many people could learn from the way this subject was handed by you.
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

ronjonp

  • Needs a day job
  • Posts: 7529
Re: define accelarator keys using lisp
« Reply #5 on: August 10, 2006, 08:06:22 PM »
Gosh  :-)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: define accelarator keys using lisp
« Reply #6 on: August 10, 2006, 09:56:39 PM »
I can only do this by other software : autohook.
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: define accelarator keys using lisp
« Reply #7 on: August 10, 2006, 10:21:46 PM »
.. and <our own> Chuck Gabriel's  HotKeys .. an excellent product ; and free, thanks to his generosity. The link has been posted in one of Chucks posts here.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

psuchewinner

  • Guest
Re: define accelarator keys using lisp
« Reply #8 on: August 11, 2006, 07:31:45 AM »
The only way that I have seen it done is by a menu.  See below.  My guess is that you could write it and initiate it with Lisp.

["F1"]'graphscr
["F2"]_endp
["F3"]_nea
["F4"]_int
["F5"]_per
["F6"]_ins
["F7"]_mid
["F9"]_cen
["F11"]_quad
["F12"]_tan
[SHIFT+"F1"]'textscr
[SHIFT+"F2"]'zoom;w
[SHIFT+"F3"]'zoom;p
[SHIFT+"F4"]'properties
[SHIFT+"F5"]'layer
[SHIFT+"F6"]'ddim

Nothing Earth Shaking but it works.  Sometimes simplicity is good.

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: define accelarator keys using lisp
« Reply #9 on: August 11, 2006, 07:47:46 AM »
.. and <our own> Chuck Gabriel's  HotKeys .. an excellent product ; and free, thanks to his generosity. The link has been posted in one of Chucks posts here.

hotkeys is a very good software, and it even afford the code, great.

I define some key by it, but I find that "TAB" cant be define, which I often define in autohook to do the ortho function which F8 does,

and I dont know how to defin "F1" as the function as "F8"--ortho in Hotkeys.

http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

Chuck Gabriel

  • Guest
Re: define accelarator keys using lisp
« Reply #10 on: August 11, 2006, 08:40:21 AM »
Thanks for the kind words Kerry.

yuangiu - If you want the tab key to toggle orthomode, you will have to edit your keys file manually because of the way the keys editor interprets the tab key.

Add a key with a modifiers value of zero, a virtual key value of 9, and (setvar "ORTHOMODE" (if (zerop (getvar "ORTHOMODE")) 1 0)) for the command value.

It sounds like autohook lets you actually map one key on the keyboard to be interpreted as an entirely different key.  HotKeys doesn't work quite that way.  It allows you to have AutoCAD execute a macro when you press a key.

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: define accelarator keys using lisp
« Reply #11 on: August 12, 2006, 09:32:01 AM »
yuangiu - If you want the tab key to toggle orthomode, you will have to edit your keys file manually because of the way the keys editor interprets the tab key.
Add a key with a modifiers value of zero, a virtual key value of 9, and (setvar "ORTHOMODE" (if (zerop (getvar "ORTHOMODE")) 1 0)) for the command value.
It sounds like autohook lets you actually map one key on the keyboard to be interpreted as an entirely different key.  HotKeys doesn't work quite that way.  It allows you to have AutoCAD execute a macro when you press a key.

Thank you, Chuck, It DOES WORK, very wonderful.
now I set in the xml for modifiers 0 and key 9 and then the tab is define:),
and the (setvar "ORTHOMODE" (if (zerop (getvar "ORTHOMODE")) 1 0))  is really work in transparent mode, very nice, how can it work, it is hard to do it, can lisp be executed transparently in command, I never try it before.

autohook is a special software just for autocad, maybe it is also wrote in arx, it is not just map key function I think, it could also execute a serial command, just like in autohook, I define ortho to tab by define tab ('^o  ), the bracket is not include, then it works, but autohook is a shareware.

Thanks again.
« Last Edit: August 12, 2006, 09:36:42 AM by yuanqiu »
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
Re: define accelarator keys using lisp
« Reply #12 on: August 12, 2006, 10:03:58 AM »
Gosh  :-)

No dont be shy. Own up to it. It was good. Now if you want to step it up to the next level...Check here and improve your methods for asking questions (which will result in more, faster, and beter answers for you). [ http://www.catb.org/~esr/faqs/smart-questions.html ]  ...Kinda makes you want to go back and fix a few of ``your'' previous questions huh? (That was a general statment, i wasnt saying that you personaly asked bad questions up untill now, im just trying to say something like: ``if we could all take the knowledge we obtain 'today' and apply that to previous encounters...'')

Now go and read that link and ask better questions and get better answers faster.

Good job Ron. Later,
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

qjchen

  • Bull Frog
  • Posts: 285
  • Best wishes to all
Re: define accelarator keys using lisp
« Reply #13 on: August 13, 2006, 09:45:48 AM »
Hi, chuck

When I define the tab key as
- <HotKey>
  <Modifiers>0</Modifiers>
  <VirtualKey>9</VirtualKey>
  <Command>(setvar "ORTHOMODE" (if (zerop (getvar "ORTHOMODE")) 1 0))</Command>
  </HotKey>

It does work transparently in some command, such as "LINE", but when in some other command, such as "Move", it exit.

How can I define it to be more like F8.

Thank you.
http://qjchen.mjtd.com
My blog http://chenqj.blogspot.com (Chinese, can be translate into English)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: define accelarator keys using lisp
« Reply #14 on: August 13, 2006, 04:43:15 PM »
Try this :

<Command>'ORTHOMODE (if (zerop (getvar "ORTHOMODE")) 1 0) </Command>

note the single quote to start
and the space to end
.

duh, FATFINGERSPELLING.
« Last Edit: August 13, 2006, 05:08:56 PM by Kerry Brown »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.