Unkown Command Issue

Unkown Command Issue

Ta7a
Enthusiast Enthusiast
466件の閲覧回数
6件の返信
メッセージ1/7

Unkown Command Issue

Ta7a
Enthusiast
Enthusiast

Hello,

 

I face a problem by netloading a dll for add-in as the only command that works fine is ParcelCreation but other give me Unkown Command Why ?  Knowing that by debugging (From VS 2022) all commands Work Fine  

 

@Jeff_M 

 

public class Commands : IExtensionApplication
{
public void Initialize()
{
}

public void Terminate()
{
}

[CommandMethod("ParcelCreation")]
public void OpenParcelCreationUI()
{
BlocksManager.Create();
}

[CommandMethod("ParcelStyleCreation")]
public void OpenParcelStyleCreationUI()
{
ThemeManager.CreateParcelStyles();
}

[CommandMethod("AssignParcelParamer")]
public void OpenParcelParameterAssignUI()
{
ParameterManager.TransferParameter();
}

[CommandMethod("AssignParcelStyle")]
public void AssignStyleofParcels()
{
ThemeManager.ApplyTheme();
}
}

 

 

0 件のいいね
解決済み
467件の閲覧回数
6件の返信
返信 (6)
メッセージ2/7

hippe013
Advisor
Advisor

It is good practice to always add an assembly attribute declaring the class as a CommandClass if the class contains CommandMethods.

See the example snippet below.

<Assembly: CommandClass(GetType(Commands.MyCommands))>
Namespace Commands
   Public Class MyCommands
   ... stuff defined in my class
   End Class
End Namespace

 

メッセージ3/7

Jeff_M
Consultant
Consultant

@hippe013 wrote:

It is good practice to always add an assembly attribute declaring the class as a CommandClass if the class contains CommandMethods.

 


Interesting...I have never used that attribute. I have about 200 classes with one, or more, CommandMethod definitions. IIRC,  the attribute is supposed to help with the speed of loading the commands but in some testing we did years ago we found it to negligible.

Jeff_M, also a frequent Swamper
EESignature
メッセージ4/7

hippe013
Advisor
Advisor

It my understanding, I don’t recall where I read it, that if the attribute is used once on any CommandClass within your assembly, then it is required for every CommandClass. Otherwise the other classes’ command methods will not load. Whenever someone complains of unknown commands it is the first thing that I think of. You can however, not use it, and all methods with the CommandMethod attribute will load as command methods. Try it. Declare one class with the CommandClass attribute and leave the rest, those commands will load while the rest will not, and will be unknown commands. 

メッセージ5/7

norman.yuan
Mentor
Mentor
What you described sounds not making sense to me: only one of the CommandMethod works, while other commands raise "Unknown command" error. Since all the CommandMethods are in the same class, either all commands are recognized, or they are not.

I suspect that the code you post here is simplified (with details are stripped), thus the possible causes of error are hidden. However, you could do a quick/easy test of creating a new project with the exact code you post here (that is, no possible noises from extra code), and run it to see what happens.

Norman Yuan

Drive CAD With Code

EESignature

メッセージ6/7

rgrainer
Collaborator
Collaborator

Parameter is misspelled

 

メッセージ7/7

Ta7a
Enthusiast
Enthusiast
解決済み

thanks for all of you

 by adding the dll path to trusted folders in civil 3d the proplem was solved

 

0 件のいいね