Re: STEP file opened via code but not visible (Home tab remains active)

When I open a STEP file through code, the file opens successfully and is set as the ActiveDocument in the code. However, in the Inventor UI, the file is opened in the background and the Home tab remains visible instead of switching to the file tab.

public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
{
Inventor.Application invApp = addInSiteObject.Application;
invApp.Visible = true;
m_inventorApplication = invApp;

string stepPath = @”D:\2dTo3D_project\1_output_renamed.step”;
if (!System.IO.File.Exists(stepPath))
return;

Document doc = invApp.Documents.Open(stepPath, true);

//Force UI activation
doc.Activate();

MessageBox.Show(“STEP opened and activated correctly”);
}

Read more here: Source link