Deactivation these after deactivate does not work
oTab = Nothing
When I start the Addin again the tab is still there after deactivate.
What is wrong in the code.
Public Sub SetupUserInterface(ByVal addInSiteObject As Inventor.ApplicationAddInSite, ByVal firstTime As Boolean, ClientID As String)
oTab = oRibbon.RibbonTabs.Add(sName & "", "AknoorsMasterAddIn" & "", ClientID)
End Sub
Public Sub Deactivate() Implements Inventor.ApplicationAddInServer.Deactivate
' This method is called by Inventor when the AddIn is unloaded.
' The AddIn will be unloaded either manually by the user or
' when the Inventor session is terminated.
' TODO: Add ApplicationAddInServer.Deactivate implementation
m_inventorApplication = Nothing
oTab = Nothing
System.GC.WaitForPendingFinalizers()
System.GC.Collect()
End Sub
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Consider adding the following into Deactivate() implementation:
....
oTab.Delete()
oTab = Nothing
...
Also then it is not released.
when you enable the add in again then the Tab is still in there and gives an error.
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
I tested the .Delete call, and it works.
Created an assembly, and added two rules into it:
Dim rib As Ribbon = ThisApplication.UserInterfaceManager.Ribbons("Assembly") Dim test As RibbonTab = rib.RibbonTabs.Add("Test","{A4C2F061-0DC3-46A5-8B31-508938EDB5B1}", "{A4C2F061-0DC3-46A5-8B31-508938EDB5B1}") Dim panel As RibbonPanel = test.RibbonPanels.Add("Update", "{DF5AA47C-1858-41D7-92B9-CB4BBB1BADF3}", "{A4C2F061-0DC3-46A5-8B31-508938EDB5B1}") Dim button As ButtonDefinition = ThisApplication.CommandManager.ControlDefinitions.Item("AppLocalUpdateCmd") panel.CommandControls.AddButton(button, True)
The Tool tab is created with Update command in it
Dim rib As Ribbon = ThisApplication.UserInterfaceManager.Ribbons("Assembly") Dim test As RibbonTab = rib.RibbonTabs("{A4C2F061-0DC3-46A5-8B31-508938EDB5B1}") test.Delete()
The "Test" tab is removed.
The rules should be run one after another.
Otherwise, the first rule fails on the second run, as RibbonTab is attempted to be created the second time.
The second rule will fail on the second run, in attempt to find non-existent RibbonTab.
The deletes you do in the deactivate routine?
Regards,
Arthur Knoors
Autodesk Affiliations:
Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!
! For administrative reasons, please mark a "Solution as solved" when the issue is solved !
Can't find what you're looking for? Ask the community or share your knowledge.