Jump to content

K/B Shortcuts for Custom Buttons/Menus..... Possible?


Recommended Posts

Posted

Hi there!

 

I've create a custom menu for use with CleanScreen and a few buttons for 'Normal' Screen....

 

thing is, i'd like to create keyboard shortcuts to these custom menus/button but i'm not sure it's possible....

 

eg. custom menu/button is "^C^C-pu;a;;n;" to which i'd like to assign the shortcut "pa" or "pu" etc....

 

this cannot be done via the alias editor (as far as i'm aware anyway) as that only accepts single command entries.

 

 

Can this be done? Thanks in advance!

  • Replies 27
  • Created
  • Last Reply

Top Posters In This Topic

  • Dave^

    14

  • Lee Mac

    10

  • lpseifert

    3

  • Strix

    1

Top Posters In This Topic

Posted

add this to your acaddoc.lsp file

(defun c:pu () (command "-purge" "a" "" "n"))

Posted

excellent!

 

i assume this can be used for any string of commands?

 

Thanks very much!!!

Posted
excellent!

 

i assume this can be used for any string of commands?

 

Thanks very much!!!

 

This is just a LISP function, that will invoke the command - hence you can make the LISP function run more than one command, or do a multitude of other things... let your imagination run wild

Posted
let your imagination run wild

 

i think i will!!

 

i love this place! thanks guys!

Posted

ok just playing with this now....

 

i found this 'string' of commands i'd like to use....

 

'zoom extents-purge-save-close' thanks to Strix on another thread, i saw this and thought it'd be uber handy to have......

 

so i've tried this:

 

(defun c:qq () (command "_zoom" "_e" "-purge" "a" "" "n" "qsave" "close"))

 

and get this error:

 

Command: close Command CLOSE is not available under SDI mode.

Command: nil

 

any ideas? can the 'close' command not be invoked via lsp?

Posted

Correct me if I am wrong, but I am not sure that you can use LISP to close a drawing, as the act of closing the drawing will cause the LISP to error.

Posted

As you found out, Close won't work when SDI=1. Try using Quit instead. (note: it isn't foolproof, e.g. if if you haven't saved the dwg prior to invoking)

Posted

Why not use a script for what you are trying to do?

 

A script could run on any number of drawings and perform as required.

Posted
Why not use a script for what you are trying to do?

 

A script could run on any number of drawings and perform as required.

 

 

and how would i do that?

 

sorry, i'm a total n00b with lisps and scripts.... custom buttons/menus and shortcuts is as deep as i go unfortunately, but during the quieter days i'm gonna be teaching myself other things....or trying to anyway!!!

 

i had a thought on the close vs. quit...... i use single drawing compatability, so 'close' doesn't work anyway, but 'quit' works fine and dandy!!!

Posted

A script is the simplest thing you can make that can automate your work. - Very easy to get the hang of, don't worry.

 

In any Notepad file, you can create your script.

 

Just write commands as if you are entering them to the command line yourself - SPACES or NEW-LINES are counted as the user hitting enter.

 

Once finished, save the file as ".scr" (make sure it is set to "All Files" in the "Save as Type" box).

 

Hence, with your example, the script would look something like:

 

open "C:/Documents/mydrawing1.dwg" zoom e -purge a n qsave close
open "C:/Documents/mydrawing2.dwg" zoom e -purge a n qsave close

 

etc etc

 

Where the filepath is the filepath of your drawings.

 

*may need a bit of tweaking..*

 

Then, when saved, just go into ACAD and go to "tools", "run script" in any new drawing session.

Posted

Cheers Lee,

 

i have done a little scripting in the past during a little tutoring session i had at work....

 

but i never went into too much detail, so didn't realise any command could be run via script.....

 

thanks again!

 

oh, and is there a list of command line commands and explanations? like command line plotting, switching thru layers etc, things that are normally done via dialog boxes.....

 

thanks in advance.....

Posted

At the command line try prefixing the command with a hyphen... e.g. -layer; it will show the available options (note: doesn't work with all commands).

or Help

Posted

You can check in the ACAD help file which commands can be prefixed by "-" i believe.

Posted

thanks,

 

i was kind of hoping for a list i could print off/look at when i'm away from the pc, rather than second guessing as to what each option does, even though most are self explanitory.....

Posted

awesome, thanks!

 

i've done a script for plotting to pdf, the only trouble with it is that i tend to change my layout name to the drawing number, which means it's not universal, which is a shame!

Posted
awesome, thanks!

 

i've done a script for plotting to pdf, the only trouble with it is that i tend to change my layout name to the drawing number, which means it's not universal, which is a shame!

 

You can make LISPs to write these script files for you - saves a lot of hassle.

 

Its still not completely fool proof, but its a lot quicker than doing it manually :wink:

Posted

first lisps, then scripts, now lisps to write scripts?!?!?!?! what next? scripts to write lisps?

 

c'mon then, how do i do that one? doesn't sound as straightforward as the previous.... and the boss is out all afternoon, so i've got nothing but time!!!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...