Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Reloading my AddIn with custom Panel causes Error

1 REPLY 1
SOLVED
Reply
Message 1 of 2
striebel.sebastian
403 Views, 1 Reply

Reloading my AddIn with custom Panel causes Error

Hello,

I´ve created a VB.NET AddIn that works as intended, but when I manually reload it, I get an unidentified Error.

 

Public Sub Activate([...])
            [...]
            If firstTime Then 
                AddToUserInterface()
            End If
End Sub

Private Sub AddToUserInterface()
            ' Get the drawing ribbon.
            Dim drawingRibbon As Ribbon = g_inventorApplication.UserInterfaceManager.Ribbons.Item("Drawing")
            ' Get the "Place Views" tab.
            Dim PlaceViewsTab As RibbonTab = drawingRibbon.RibbonTabs.Item("id_TabPlaceViews")
            ' Create a new panel.
            Dim PrintAddInPanel As RibbonPanel = PlaceViewsTab.RibbonPanels.Add("Print Service", "PrintAddInPanel", AddInClientID)

            ' Add buttons to Ribbon Panel.
            PrintAddInPanel.CommandControls.AddButton(m_Print_PDF, False, True)
[...]
End Sub

I get the Error the line where I add my custom RibbonPanel.

What code do I need to add to make it work?
Do I need something in the Deactivate() Sub?

Thanks in advance.

Labels (3)
1 REPLY 1
Message 2 of 2

Never mind.

I figured it out by myself. Just add this to your code and everything works just fine.

Public Sub Deactivate() Implements Inventor.ApplicationAddInServer.Deactivate
     PrintAddInPanel.Delete()
End Sub

 

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report