Looking for sample C# addin with button added to a ribbon panel

Looking for sample C# addin with button added to a ribbon panel

Anonymous
Not applicable
4,008 Views
10 Replies
Message 1 of 11

Looking for sample C# addin with button added to a ribbon panel

Anonymous
Not applicable

I've got the functionality I want as a stand alone interface to Inventor but I'm now trying to create this as an Addin. 

 

I've added the ButtonDefinition, enabled it, and hooked up an event handler to the OnExecute event of the ButtonDefinition but it won't reach that method when I hit the button.

 

I'm sure I'm close but something is eluding me.

 

Any help would be appreciated. I'm using VS2017 and would prefer a sample that isn't using obsolete methods or 32 bit only libraries as with the SDK samples for C#. 

 

Thank you,

 

John

 

0 Likes
Accepted solutions (1)
4,009 Views
10 Replies
Replies (10)
Message 2 of 11

Ruffy85
Collaborator
Collaborator

@Anonymous

 

Please check the sampleAddin in the developer Tools. There are a lot of examples for your issue.

If my reply was helpful, please give a "Kudo" or click the "Accept as Solution" button below (or both).
0 Likes
Message 3 of 11

Martin-Winkler-Consulting
Advisor
Advisor
Accepted solution

Hi john,

i prefer http://spiderinnet2.typepad.com/blog/2012/06/a-wizard-for-inventor-net-addin.html to set up Addins

For me it was a good time saving investment.

 

Best Regards

Martin

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes
Message 4 of 11

Anonymous
Not applicable

Hello Ruffy85,

 

Do you mean SimpleAddin? that gives me these warnings:

 

Severity Code Description Project File Line Suppression State
Warning CS0618 'Support' is obsolete: 'Microsoft.VisualBasic.Compatibility.* classes are obsolete and supported within 32 bit processes only. http://go.microsoft.com/fwlink/?linkid=160862' SimpleAddIn C:\VS Projects\Autodesk Dev\Autodesk Inventor 2018 SDK\DeveloperTools\Samples\VCSharp.NET\AddIns\SimpleAddIn\Button.cs 60 Active
Warning CS0618 'Support.IconToIPicture(Icon)' is obsolete: 'Microsoft.VisualBasic.Compatibility.* classes are obsolete and supported within 32 bit processes only. http://go.microsoft.com/fwlink/?linkid=160862' SimpleAddIn C:\VS Projects\Autodesk Dev\Autodesk Inventor 2018 SDK\DeveloperTools\Samples\VCSharp.NET\AddIns\SimpleAddIn\Button.cs 60 Active
Warning CS0618 'Support' is obsolete: 'Microsoft.VisualBasic.Compatibility.* classes are obsolete and supported within 32 bit processes only. http://go.microsoft.com/fwlink/?linkid=160862' SimpleAddIn C:\VS Projects\Autodesk Dev\Autodesk Inventor 2018 SDK\DeveloperTools\Samples\VCSharp.NET\AddIns\SimpleAddIn\Button.cs 63 Active
Warning CS0618 'Support.IconToIPicture(Icon)' is obsolete: 'Microsoft.VisualBasic.Compatibility.* classes are obsolete and supported within 32 bit processes only. http://go.microsoft.com/fwlink/?linkid=160862' SimpleAddIn C:\VS Projects\Autodesk Dev\Autodesk Inventor 2018 SDK\DeveloperTools\Samples\VCSharp.NET\AddIns\SimpleAddIn\Button.cs 63 Active

0 Likes
Message 5 of 11

Anonymous
Not applicable

Thanks Martin,

 

Will that work with VS2017 and Inventor 2018? 

 

--John

0 Likes
Message 6 of 11

Martin-Winkler-Consulting
Advisor
Advisor

Hi John,

i am using it with VS2015 and Inventor 2016/2017 and with VB.NET

But i think it should also works with VS2017 and Inventor 2018.

 

The only thing is that you have to change the SoftwareVersion Numbe in the .Addin file

 

 <SupportedSoftwareVersionGreaterThan>19..</SupportedSoftwareVersionGreaterThan>
  <SupportedSoftwareVersionLessThan>21..</SupportedSoftwareVersionLessThan>

For Inventor 2018 it should be 22

 

The Wizard creates a complete Standard AddIn Server: After understanding how it works you can add very easy your Features, Ribbons, Buttons .......

3DCS_2017.09.05_07h24m37s_001_.jpg

 

Let me/us know if there are any problems in your case because i will soon also change to C# and Inventor 2018.

 

Best Regards

 

Martin

 

 

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes
Message 7 of 11

Martin-Winkler-Consulting
Advisor
Advisor

Tip:

I think the SimpleAddIn example is very old and was not developed the last years. I also had a lot of trouble with the .IconToIPicture(Icon) Function.

 

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

0 Likes
Message 8 of 11

Anonymous
Not applicable

Thank you. How soon with the C#/2018? Are you with Net Spider Studio?

0 Likes
Message 9 of 11

Martin-Winkler-Consulting
Advisor
Advisor

Hi john,

this could be weeks, too much work in other areas 😉 at the moment.

I am only customer with spider net studio and bought 1 Lizenz.

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature

Message 10 of 11

Anonymous
Not applicable

So the Net Spider tool already works with Inv 2018. I used it to build an addin within VS 2015 and then opened that project with VS 2017 to work on it. It's not creating the XCOPY post build events for some reason but I added those in myself using the Inventor 2018 SDK add in template as my guide. 

 

The Net Spider Deactivate method in the InventorAddinServe class throws an error after inventor closes. It happens whey they try to do Marshal.FinalReleaseComObject(AddinGlobal.InventorApp)

 

I'm working with them on that. 

 

I'd say it's ready to use as long as you don't mind starting in VS 2015. 

Message 11 of 11

Martin-Winkler-Consulting
Advisor
Advisor

It's interesting that the problem in the closing section persists with Inventor 2018.

I wrote about this here.

With Inventor 2016 and earlier there is no Error.

I deleted the Closing Inventor section in my 2017 project and it seems to be that the closiing is not neccessary.

 

  'Closing Inventor
        If AddinGlobal.InventorApp IsNot Nothing Then
            Marshal.FinalReleaseComObject(AddinGlobal.InventorApp)
        End If

Martin Winkler
CAD Developer
Did you find this post helpful? Feel free to like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


EESignature