- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Detect active tab in inventor
Hi everyone, Is it possible to detect when the active tab changes in Inventor and execute a rule automatically?
If anyone knows how to achieve this, I'd be grateful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi @Luis_Pacheco_3D. I do not think that is possible right now. I know that the RibbonTab object has a property called 'Active' that we can check the status of, but I have never seen a specific event that Autodesk has given us access to through the Inventor API for when a RibbonTab gets activated. They obviously have something on their end, but I just don't think it has been exposed to us users yet.
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
It is possible to do this with VBA?
Can you give me an example to get the name of the active ribbon tab with ilogic? I have an idea to work with that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Sure. Below is a simple example that, when ran, will show a message telling you which tab is currently active.
Dim oEnv As Inventor.Environment = ThisApplication.UserInterfaceManager.ActiveEnvironment
For Each oTab As RibbonTab In oEnv.Ribbon.RibbonTabs
If oTab.Active Then
MsgBox("The tab named '" & oTab.DisplayName & "' is currently active.", vbInformation, "")
End If
Next
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
This iLogic rule will give you the name of the active ribbon tab (in the active ribbon)
For Each ribbon As Ribbon In ThisApplication.UserInterfaceManager.Ribbons
If (Not Ribbon.Active) Then Continue For
For Each ribbonTab As RibbonTab In Ribbon.RibbonTabs
If (RibbonTab.Active) Then
MsgBox(String.Format("Ribbon tab '{0}' in ribbon '{1}' is active",
RibbonTab.DisplayName, Ribbon.InternalName))
End If
Next
Next
Jelte de Jong
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.
Blog: hjalte.nl - github.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@JelteDeJong @WCrihfield My apologies to you, I guess I used the wrong term.
When I say ACTIVE TAB, I refer to the item that I show in the image below.
My bad. Sorry. In Spanish, I call it "Pestaña". The active Document.
So, with the correction, it is possible to run a specific rule when I change the "Pestaña"?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I think one of these two lines may be what you are looking for then.
Dim oActiveDoc As Document = ThisApplication.ActiveDocument
Dim oVTab1 As ViewTab = oActiveDoc.Views.Item(1).ViewTab
Dim oVTab2 As ViewTab = ThisApplication.ActiveView.ViewTab
Wesley Crihfield
(Not an Autodesk Employee)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
For this purpose you can use this events for example
ApplicationEvents.OnActivateView Event
or
ApplicationEvents.OnActivateDocument Event