CADTutor: The best free help for AutoCAD on the web

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
Go Back   AutoCAD Forums > AutoCAD > AutoLISP, VBA, the CUI & Customisation

Reply
 
Thread Tools
Old 3rd Nov 2009, 11:27 pm   #1
maxoffset
Forum Newbie
 
Using: AutoCAD 2008
 
Join Date: Nov 2009
Posts: 2
Default How to you set up new commands for buttons?

ive made some custom buttons and was wondering how to set up a new keyboard command.

so typing a command to start the command instead of clicking on it.

Thanks in advance.
maxoffset is offline   Reply With Quote
Old 3rd Nov 2009, 11:55 pm   #2
lpseifert
Forum Deity
 
Using: Civil 3D 2009
 
Computer Details
 
Join Date: Sep 2006
Location: Pittsburgh, PA, USA
Posts: 2,566
Default

You can just type the command at the command line...
If you want a command alias (shortcut for a command) you can edit your acad.pgp file, easily done by typing Aliasedit at the command line.
lpseifert is offline   Reply With Quote
Old 4th Nov 2009, 03:07 am   #3
BIGAL
Super Member
 
Using: Civil 3D 2008
 
Join Date: Dec 2005
Location: GEELONG AUSTRALIA
Posts: 768
Default

You can define any command as a different keyboard command we use stuff like "39" sets the osnap "dv" driveway "XFP" cross fall as a percent

You just do little lisps save in autoload etc
(defun C:39 ()
(setvar "osmode" 39)
)

I like zzz aaa qqq its easy to get at and unlikely to be used by Autocad. just make them so they run a lisp program etc

(defun C:aaa ()
(load "myprog1")
(myprog1) :if it has a defun definition already else leave out
)
BIGAL is offline   Reply With Quote
Old 4th Nov 2009, 03:23 am   #4
alanjt
Super Member
 
alanjt's Avatar
 
Using: Civil 3D 2009
 
Join Date: Apr 2008
Posts: 1,488
Default

Quote:
Originally Posted by maxoffset View Post
ive made some custom buttons and was wondering how to set up a new keyboard command.

so typing a command to start the command instead of clicking on it.

Thanks in advance.
If you mean macros, you will need to convert them to lisp.

Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...
its pretty funny seeing two AutoCAD Gods give each other flak...
alanjt is offline   Reply With Quote
Old 4th Nov 2009, 10:33 pm   #5
maxoffset
Forum Newbie
 
Using: AutoCAD 2008
 
Join Date: Nov 2009
Posts: 2
Default

thx for the responses. i was really hoping i could somehow set a new command without this lisp file. currently i have no idea how to create these files.

I was hoping since it was easy enough to create a macro (new command button) to click on that i could also accompany it with a type command. I noticed i can set hotkeys (ctrl+k for example) but i couldnt make new command lines.

If thats the only way to do it ill try to look into lisp files.
maxoffset is offline   Reply With Quote
Old 4th Nov 2009, 11:16 pm   #6
alanjt
Super Member
 
alanjt's Avatar
 
Using: Civil 3D 2009
 
Join Date: Apr 2008
Posts: 1,488
Default

Quote:
Originally Posted by maxoffset View Post
thx for the responses. i was really hoping i could somehow set a new command without this lisp file. currently i have no idea how to create these files.

I was hoping since it was easy enough to create a macro (new command button) to click on that i could also accompany it with a type command. I noticed i can set hotkeys (ctrl+k for example) but i couldnt make new command lines.

If thats the only way to do it ill try to look into lisp files.


Maybe something like this:

Code:
(defun MacroIt (#Macro)
  (vl-load-com)
  (or *AcadDoc* (setq *AcadDoc* (vla-get-activedocument (vlax-get-acad-object))))
  (vla-sendcommand *AcadDoc* (vl-princ-to-string #Macro))
) ;_ defun


(defun c:Test1 (/) (MacroIt "-layer set 0\n\n\n") (princ))
(defun c:Test2 (/) (MacroIt "-layer make TEMP\n\n\nline ") (princ))
You would just have to modify your macros a little.

Seann: ...it went crazy ex-girlfriend on me...
eric_monceaux...
its pretty funny seeing two AutoCAD Gods give each other flak...
alanjt is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Propertie's Buttons JONTHEPOPE AutoCAD General 4 27th Dec 2008 04:46 pm
New buttons quasifun AutoLISP, VBA, the CUI & Customisation 1 27th Sep 2007 05:28 pm
mtext commands for buttons - please help jwitzel AutoLISP, VBA, the CUI & Customisation 6 24th Aug 2007 12:44 am
Assigning commands to mouse buttons Siberian AutoCAD General 4 26th Oct 2006 11:17 am
How do you bind commands to stylus buttons??? luke13 AutoCAD Drawing Management & Output 0 27th Jul 2005 10:53 pm

Why Donate?


All times are GMT +1. The time now is 11:43 am.

RSS Feed for AutoCAD ForumsValid XHTML 1.0!Valid CSS!Creative Commons Licence