Detect active tab in inventor

Detect active tab in inventor

Luis_Pacheco_3D
Advocate Advocate
436 Views
7 Replies
Message 1 of 8

Detect active tab in inventor

Luis_Pacheco_3D
Advocate
Advocate

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.

0 Likes
437 Views
7 Replies
Replies (7)
Message 2 of 8

WCrihfield
Mentor
Mentor

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

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 8

Luis_Pacheco_3D
Advocate
Advocate

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.

0 Likes
Message 4 of 8

WCrihfield
Mentor
Mentor

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

EESignature

(Not an Autodesk Employee)

Message 5 of 8

JelteDeJong
Mentor
Mentor

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.

EESignature


Blog: hjalte.nl - github.com

Message 6 of 8

Luis_Pacheco_3D
Advocate
Advocate

@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.

 

luispacheco6P5Y8_0-1677785844158.png

 

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"?

 

 

 

 

 

 

0 Likes
Message 7 of 8

WCrihfield
Mentor
Mentor

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

EESignature

(Not an Autodesk Employee)

0 Likes
Message 8 of 8

Michael.Navara
Advisor
Advisor