Same command on two plugins best pratice

Hello ,

I have several custom commands, and I need to share these commands by more than one pugin on the same pc.

All plugins will need the same commands, I can’t repeat the same command on two different plugins on same pc, but I need that same pc run just one, or just the other, or the both plugins.

What is the best solution in this specific case?

Thanks

Hi @MatrixRatrix,

Why do you have the same command (name) in multiple plug-in?

– Dale

Hello @dale

I want create distint plug-ins but, I write functions that I want re-use on others.

If you have functions that you want to share between plug-in, then you should create a utility class library and have each plug-in project reference that library.

Or am I still confused what you want to do?

– Dale

Hello @dale

No, you not confused, maybe i’m confusing you with my lack of experience :slight_smile:

If I understand well:

1º Create a new class library projet.
2º Create (or pass) all my custom commands
3º Add this ref to my plugin and use.

Yes?

Hi @dale

I create a class library for use as dll on each plugin that I make.

Inside this library I create some commands (“EnglishName”) , but I am not able to load these commands when the plugin is loaded in rhino, what is the procedure?

Thanks

Hi @MatrixRatrix I believe Rhino will only load commands automagically from a Plugin.
If you want to load Commands from a library you’d have to override the Plugin.CreateCommands and create some code to load the ones in your library. The nice thing is you could override this in the same way for each of your plugins and call the commands from the library with each one.

/ Callum