Actually this can be done with any add-in, including custom add-ins loaded on Inventor, as shown at this blog post.
Here we show how get a built-in Translator add-in and call its SaveAsCopy method. This will create a .igs file for the current open .ipt file. For simplicity, minimal error check is included on the code.
// get the "Translator: IGES" addin
Inventor.ApplicationAddIn addin = _inventorApp.
ApplicationAddIns.get_ItemById(
"{90AF7F44-0C01-11D5-8E83-0010B541CD80}");
// check if is a valid translator add-in
Inventor.TranslatorAddIn igsSaveAs =
addin as Inventor.TranslatorAddIn;
if (igsSaveAs == null)
{
MessageBox.Show(
"Unable to get the translator add-in");
return;
}
// context object
Inventor.TranslationContext context =
_inventorApp.TransientObjects.
CreateTranslationContext();
context.Type = Inventor.
IOMechanismEnum.kFileBrowseIOMechanism;
// and the data parameter
Inventor.DataMedium data =
_inventorApp.TransientObjects.
CreateDataMedium();
data.FileName = "c:\\temp\\file.igs";
// configure the options...
Inventor.NameValueMap options =
_inventorApp.TransientObjects.
CreateNameValueMap();
if (igsSaveAs.get_HasSaveCopyAsOptions(
_inventorApp.ActiveDocument,
context, options))
{
options.Value["GeometryType"] = 1;
options.Value["SolidFaceType"] = 0;
options.Value["SurfaceType"] = 0;
}
// finally save as the file as .igs
igsSaveAs.SaveCopyAs(
_inventorApp.ActiveDocument,
context, options, data);