Home Tab Opening via VB Script / VBA

Home Tab Opening via VB Script / VBA

georg_hartmannV6HPW
Explorer Explorer
131 Views
2 Replies
Message 1 of 3

Home Tab Opening via VB Script / VBA

georg_hartmannV6HPW
Explorer
Explorer

Hello,

I ran into a littel caveat with my code, that opens my CAD Files.

It is a little plugin for an UML Modeler, that can open corresponding CAD Files, if i have the file path.

It generates a CMD Command to run :

cscript //Job:fileOpener CADInterface.wsf CAD_filepath

and the job script inside looks like :

Dim InvApp, InvDoc
Dim fso, fullPathToFile,strFileName

Sub main()
	'On Error Resume Next
    wscript.Echo(">>> FileOpener v1  <<<")

    ' Initialize Inventor
    set InvApp = CreateObject("Inventor.Application")
    InvApp.Visible = True 
    
    ' Generate absolute filepath to CAD-File 
    strFileName = Wscript.arguments(0)
    set fso = CreateObject("Scripting.FileSystemObject")
    fullPathToFile = fso.GetAbsolutePathName(strFileName)

    Set InvDoc = InvApp.Documents.open(fullPathToFile,true)

'InvApp.UserInterfaceManager.ResetRibbonInterface() 
'InvApp.UserInterfaceManager.Ribbons.Item("Part")
 '   InvApp.UserInterfaceManager.Update
  '  InvApp.UserInterfaceManager.ActivateTab("Id_Part")

End Sub

 

This in itself works like a charm , but it does not open the home Tab in inventor 2024, which in turn means, that i have no control over the part or make adjustments.

georg_hartmannV6HPW_0-1747734232614.png

 

I could click it every time, but it would be great , if i can open it automatically.

 

Can this be done ?

 

Best Regards

Georg

0 Likes
132 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

Hi @georg_hartmannV6HPW.  I am not sure if there is any true Inventor API way to show Inventor's 'Home' tab, but I suspect that we could show it by executing the proper 'command' (ControlDefinition) for showing it that gets executed when we click that button in the user interface.  I do not recall that exact command name, but I think it was either "AppShowHomeBaseCmd" or "FWxInventorHomeCmd".

ThisApplication.CommandManager.ControlDefinitions.Item("commandName").Execute()

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

tim11_manhhieu
Advocate
Advocate

ThisApplication.CommandManager.ControlDefinitions.Item("AppShowHomeBaseCmd").Execute()

0 Likes