Dave^ Posted May 11, 2009 Posted May 11, 2009 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! Quote
lpseifert Posted May 11, 2009 Posted May 11, 2009 add this to your acaddoc.lsp file (defun c:pu () (command "-purge" "a" "" "n")) Quote
Dave^ Posted May 11, 2009 Author Posted May 11, 2009 excellent! i assume this can be used for any string of commands? Thanks very much!!! Quote
Lee Mac Posted May 11, 2009 Posted May 11, 2009 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 Quote
Dave^ Posted May 11, 2009 Author Posted May 11, 2009 let your imagination run wild i think i will!! i love this place! thanks guys! Quote
Dave^ Posted May 11, 2009 Author Posted May 11, 2009 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? Quote
Lee Mac Posted May 11, 2009 Posted May 11, 2009 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. Quote
lpseifert Posted May 11, 2009 Posted May 11, 2009 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) Quote
Lee Mac Posted May 11, 2009 Posted May 11, 2009 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. Quote
Dave^ Posted May 12, 2009 Author Posted May 12, 2009 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!!! Quote
Lee Mac Posted May 12, 2009 Posted May 12, 2009 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. Quote
Dave^ Posted May 12, 2009 Author Posted May 12, 2009 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..... Quote
lpseifert Posted May 12, 2009 Posted May 12, 2009 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 Quote
Lee Mac Posted May 12, 2009 Posted May 12, 2009 You can check in the ACAD help file which commands can be prefixed by "-" i believe. Quote
Dave^ Posted May 12, 2009 Author Posted May 12, 2009 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..... Quote
Lee Mac Posted May 12, 2009 Posted May 12, 2009 This is quite useful http://www.hyperpics.com/commands/ Quote
Dave^ Posted May 12, 2009 Author Posted May 12, 2009 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! Quote
Lee Mac Posted May 12, 2009 Posted May 12, 2009 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: Quote
Dave^ Posted May 12, 2009 Author Posted May 12, 2009 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!!! Quote
Recommended Posts
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.