Adding New Icons with Toolbar Add-in

How do I add new toolbar icons using your toolbar template? I've created a windows form called "Tester.vb" and basically replicated every single thing I saw related to your "About.vb" form. Everytime I compile it I only see the two default icons from the template. Another thing, how do I get the icons to show the proper image? I've run the ReleaseBuild.bat file but this doesn't seem to do the trick. Also, I tried creating a new GUID like you showed us at the summit. Lastly, what is the proper way to add the new icon to Addin.res? I noticed each image shows all the icons within them.

 

Here is a snippet from the Addin.vb file:

 

Public Sub OnConnectToEnvironment(ByVal EnvCatID As String, ByVal pEnvironmentDispatch As Object, ByVal bFirstTime As Boolean) Implements SolidEdgeFramework.ISolidEdgeAddIn.OnConnectToEnvironment

Dim commandNames(2) As String

Dim commandIDs(2) As Integer

Try

commandNames(0) = "cmdAbout\n\nAbout SEAddin1___Toolbar\nAbout SEAddin1___Toolbar"

commandNames(1) = "cmdOpenFile\n\nOpen File\nOpen File"

commandNames(2) = "cmdTester\n\nTester SEAddin1___Toolbar\nTester SEAddin1___Toolbar"

commandIDs(0) = 101

commandIDs(1) = 102

commandIDs(2) = 103

addin.SetAddInInfo(Marshal.GetHINSTANCE(Me.GetType().Module).ToInt32(), EnvCatID, "SEAddin1___Toolbar", 1, 2, 1, 2, 2, commandNames, commandIDs)

 

If (bFirstTime) Then

Dim environment As SolidEdgeFramework.Environment

environment = pEnvironmentDispatch

environment.CommandBars.Add("SEAddin1___Toolbar", SolidEdgeFramework.SeBarPosition.seBarTop, False, False)

addin.AddCommandBarButton(EnvCatID, "SEAddin1___Toolbar", 101)

addin.AddCommandBarButton(EnvCatID, "SEAddin1___Toolbar", 102)

addin.AddCommandBarButton(EnvCatID, "SEAddin1___Toolbar", 103)

 

Secondly for the edgebar addin do we need to be using V17 for it to work? As soon as I load the add-in I get 7 command line errors with calls to SolidEdgeFramework.SolidEdgeDocument. It seems SolidEdgeDocument is not in the V15 framework that I'm using. Is there an alternative class to use for V15?

 

Posted by: John Slipec
Post date: 10/7/2005 6:50:53 AM

7 REPLIES

RE: Adding New Icons with Toolbar Add-in

John,

 

Your code looks pretty good. You need to update SetAddinInfo though. The 3rd to last parameters is NumberOfCommands. Change that to 3 or you could do something like commandIDs.Length to make it dynamic. I should have done that in my example.

 

The toolbar images in Addin.res are as follows:

 

Bitmap ID #1 = 16 x # Commands * My example was 16 x 32, yours would need to be 16 x 48.

Bitmap ID #2 = 24 x # Commands

 

You'd have to increase the width of each to make room for any additional command button images.

 

Regarding the SolidEdgeDocument interface, I do not know when it was introduced to the framework.

 

Why don't you upload your .zip'd project to a reply post and I'll look at it for you. I really need to see what kind of errors that you're getting.

 

Let me know.

 

Posted by: Jason Newell
Post date: 10/10/2005 5:33:43 AM

RE: Adding New Icons with Toolbar Add-in

Jason,

 

Thanks again, worked like a charm

 

Now I just have to figure out what to put onto my nice new toolbar

 

 

Posted by: John Slipec
Post date: 10/14/2005 9:39:08 AM

RE: Adding New Icons with Toolbar Add-in

 

Hi John and all,

Kindly Send the VB.Net templates for developing Add-In (If anybody have). I want to construct a menu and toolbar for my solide edge application and also for practice.

Thanks

Jaya

 

Posted by: jaya priyan
Post date: 12/19/2007 5:59:10 PM

RE: Adding New Icons with Toolbar Add-in

 

Jaya,

What version of Visual Studio .NET are you using?  2003 or 2005.  I had templates for 2003 but when .NET 2.0 came out, Microsoft broke parts of the Interop layer which in turn broke my templates.  I have been working on 2005 templates but they are not purely a VB.NET or C# solution.  The only right way to deal with COM addins is to use a C++ shim.  That means you'll have 2 projects, a C++ shim and VB.NET or C# library.  If you will tell me what you want your solution named, I'll create one and get you started.  My 2005 templates are just not ready for the masses yet.

 

Posted by: Jason Newell
Post date: 12/19/2007 7:54:47 PM

RE: Adding New Icons with Toolbar Add-in

 

Thanks for your reply Jason

 

I have VB.Net 2005. The solution may be named as SEAdd-In

and I am using SolidEdge V18.(FYI)

 

Thanks

Jaya

 

Posted by: jaya priyan
Post date: 12/19/2007 8:07:48 PM

RE: Adding New Icons with Toolbar Add-in

 

Jaya,

One of the inherent problems with writing .NET addins is that you do not have control over which version of the runtime is loaded by the hosting application.  Using VB.NET 2005, your addin will require v2.0.50727 of the framework.  Solid Edge V18 uses v1.1.4322 of the framework so your addin will not load.  Solid Edge V19 & V20 use v2.0.50727 of the framework.  You can validate this by looking at "C:\Program Files\Solid Edge V18\Program\Edge.exe.config".  Specifically the element.

 

I have Visual C++ templates for Solid Edge addins that will work for any version of Solid Edge as they do not require .NET.  You should install them at look at the code.

Now you're starting to see why I'm not too keen on .NET addins.  While it's technically feasible to create them, you often end up with more trouble that their worth.  I am still trying to put together my 2005 .NET addin templates.  It just takes time and I don't seem to have enough of it.

 

Posted by: Jason Newell
Post date: 12/20/2007 6:59:26 AM

RE: Adding New Icons with Toolbar Add-in

how to show add-in in solid edge. add-in is created using vb.net but its not displayed in se.

 

Posted by: Shruthi M
Post date: 8/15/2011 11:47:08 PM