Jump to content

Create a command name for new buttons to type into the command line?


Recommended Posts

Posted

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!

Posted

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

Posted

I know that with the release of 2009 a command alias can be used to launch an action macro.

Posted
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!

Posted

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.

Posted
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!

Posted

I like your user name. "DWG Destroyer" :D Is your favorite command EXPLODE.:D:D:D

Posted
I like your user name. "DWG Destroyer" :D Is your favorite command EXPLODE.:D:D:D

 

Haha. Indeed, especially when dimensions are afoot...

Posted
Haha. Indeed, especially when dimensions are afoot...

 

 

:| :| :|:|

 

Please no..

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...