DWG Destroyer Posted July 23, 2009 Posted July 23, 2009 This is a question I have been asking myself for the past few months. I have created a macro and put it on the toolbar as a button, but now I would much like to assign this new button a command reference so instead of clicking the button, I could type it into the command line. Is this at all possible? I've sifted through endless explanations on macro creating all to no avail, and come to this final, seemingly forlorn attempt. Many thanks! Quote
lpseifert Posted July 23, 2009 Posted July 23, 2009 You could add something similar to this to your acaddoc.lsp file (this example will align the UCS to a selected entity by entering UE at the command line) (defun c:ue ()(command "ucs" "e")) If you need further help, post your macro Quote
ReMark Posted July 23, 2009 Posted July 23, 2009 I know that with the release of 2009 a command alias can be used to launch an action macro. Quote
DWG Destroyer Posted July 24, 2009 Author Posted July 24, 2009 You could add something similar to this to your acaddoc.lsp file (this example will align the UCS to a selected entity by entering UE at the command line)(defun c:ue ()(command "ucs" "e")) If you need further help, post your macro Hmm do you mean create a new acaddoc.lsp to use in conjunction with the standard one AutoCAD refers to? I was under the impression that the editing of the standard acaddoc.lsp was discouraged... Also, the macro you specified already has a command name, i.e. "UCS". It is good that this can be enhanced to recognise "UE" to perform a function of the command, but what do I do when the command I’m trying to use doesn’t have a standard command name? In my case, I would like to simply hit "0" then enter, to jump to layer 0 without clicking. There may already be a way to do this via the keyboard, there may not, but the point I’m trying to make is that when a new command/ macro is created by the user, it becomes something of a challenge to assign a keyboard command to enter into the command line to execute this new macro. Here is the macro I put together to achieve this; ^C^C-LAYER;S;0;; Works fine as a button, but would be better if I could hit "0, ENTER" to get the job done. Hope you can help! Quote
lpseifert Posted July 24, 2009 Posted July 24, 2009 Hmm do you mean create a new acaddoc.lsp to use in conjunction with the standard one AutoCAD refers to? I was under the impression that the editing of the standard acaddoc.lsp was discouraged... You're welcome... Who gave you that impression? That's what the acaddoc.lsp is for. Type (findfile "acaddoc.lsp) and add the following code to it. BTW if you have an acaddoc.lsp file, it was created, it doesn't come as a "standard". (defun c:0 () (command "-layer" "s" "0" "")) you may want to change c:0 to something like c:L0; I don't think using an integer as a command name is such a good idea, it may cause problems down the line. Quote
DWG Destroyer Posted July 24, 2009 Author Posted July 24, 2009 You're welcome...Who gave you that impression? That's what the acaddoc.lsp is for. Type (findfile "acaddoc.lsp) and add the following code to it. BTW if you have an acaddoc.lsp file, it was created, it doesn't come as a "standard". (defun c:0 () (command "-layer" "s" "0" "")) you may want to change c:0 to something like c:L0; I don't think using an integer as a command name is such a good idea, it may cause problems down the line. Not so much who as what. I think I misinterpreted slighlty, i meant the acad2008doc.lsp file. But yes I understand, a new one is created for customisations. Thanks a bunch for your help, whacked that code right in there and its working a treat. Cheers! Quote
JeepMaster Posted July 24, 2009 Posted July 24, 2009 I like your user name. "DWG Destroyer" Is your favorite command EXPLODE.:D:D Quote
DWG Destroyer Posted July 24, 2009 Author Posted July 24, 2009 I like your user name. "DWG Destroyer" Is your favorite command EXPLODE.:D:D Haha. Indeed, especially when dimensions are afoot... Quote
flowerrobot Posted July 25, 2009 Posted July 25, 2009 Haha. Indeed, especially when dimensions are afoot... :| :| Please no.. 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.