Custom CommandMethod

Custom CommandMethod

Amremad
Collaborator Collaborator
1,292 Views
8 Replies
Message 1 of 9

Custom CommandMethod

Amremad
Collaborator
Collaborator

hi

how can i let user that use my dll , change the command that he what

 

    <CommandMethod("CC")>
    Public Sub CopyMyContent()
        CopyContents.CopyContent()
    End Sub

ex :  how can i change cc to cmc

0 Likes
Accepted solutions (1)
1,293 Views
8 Replies
Replies (8)
Message 2 of 9

hgasty1001
Advisor
Advisor

Hi,

 

"how can i change cc to cmc": Use Alias editor in express tools.

 

Gaston Nunez

 

 

0 Likes
Message 3 of 9

Amremad
Collaborator
Collaborator

no no , there 's registry way to change by code

0 Likes
Message 4 of 9

DiningPhilosopher
Collaborator
Collaborator

There's no way to change it in the registry unless it is some sort of alias.

 

The command will be defined using the string given in the CommandMethod attribute.

 

You can define an alias for the command in the .PGP file, or with LISP.

0 Likes
Message 5 of 9

Amremad
Collaborator
Collaborator

that's i mean , but i don't know how

 

Untitled.jpg

0 Likes
Message 6 of 9

dgorsman
Consultant
Consultant

Best bet, use a verbose command name like "SOMESORTOFCOMMANDNAME" rather than "SS".  Far less likely to result in conflict with other commands and user managed aliases.  If a user wants to use "SS", "SSC", or whatever they can use the PGP to create the alias as they want.

----------------------------------
If you are going to fly by the seat of your pants, expect friction burns.
"I don't know" is the beginning of knowledge, not the end.


Message 7 of 9

arcticad
Advisor
Advisor

I don't see that registry key in my version. is that something you added and want autocad to pick it up?

How was it assigned?

---------------------------



(defun botsbuildbots() (botsbuildbots))
0 Likes
Message 8 of 9

_gile
Consultant
Consultant

Hi,

 

I agree with dgorsman.

By my side, I use my registered developper symbol as prefix for command names and let the user free to define aliases or to rename the command with LISP.



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

0 Likes
Message 9 of 9

DiningPhilosopher
Collaborator
Collaborator
Accepted solution

The entry in the registry is how AutoCAD loads your app before the first time the command is used. As soon as it is loaded, the command is defined and AutoCAD invokes that command. It does not 'define' the name of the command as you may be presuming.

 

If you change that value in the registry you have to change the name of the command as well. 

 

Adding an alias for a command is something that you should allow the user to do, which is quite easy. The reason why you shouldn't define aliases is because you don't know if the user may have already used the same alias you've chosen.