4 Replies Latest reply on Apr 3, 2017 1:51 PM by Ross John

    VB.NET Addin: How to create a single command, not a command group?

    Ross John

      Hello everyone!

      I am using standard VB.NET Addin templete and confused with the ICommandManger. Link: http://help.solidworks.com/2015/english/api/sldworksapi/SolidWorks.Interop.sldworks~SolidWorks.Interop.sldworks.ICommandManager_members.html


      In the VB.NET Addin templete, the two commands are created in GreateCommandGroup2. Quote from the templete:

              cmdIndex0 = cmdGroup.AddCommandItem2("CreateCube", -1, "Create a cube", "Create cube", 0, "CreateCube", "", mainItemID1, menuToolbarOption)

              cmdIndex1 = cmdGroup.AddCommandItem2("Show PMP", -1, "Display sample property manager", "Show PMP", 2, "ShowPMP", "PMPEnable", mainItemID2, menuToolbarOption)


      My question: If I only need to create one single command, do I have to create a command group first, then put that single command into the command group? Is this the correct way? Or is there some other methods to create such a single command?


      Furthermore: Is it OK if I create multi CommandGroup in one Addin file? (I have not tried yet.)


      Thank you!