By Wayne Brill
If you need to get a notification when the user exports to other formats such as IGES, STEP or SAT use the ApplicationEvents.OnTranslateDocument event. This event is fired when a document is translated to a different format. The code snippet below is a C# example.
This SDK project shows how to use events in VB.NET:
C:\Users\Public\Documents\Autodesk\Inventor 2013\SDK\DeveloperTools\Tools\EventWatcher
C# code snippet:
private void InitEvent()
{
oAppEvents = _invApp.ApplicationEvents;
oAppEvents.OnTranslateDocument +=
new
ApplicationEventsSink_OnTranslateDocumentEventHandler
(oAppEvent_OnTranslateDocument);
}
void oAppEvent_OnTranslateDocument
(bool TranslatingIn,
Inventor._Document DocumentObject,
string FullFileName,
EventTimingEnum BeforeOrAfter,
NameValueMap Context,
out HandlingCodeEnum HandlingCode)
{
string extension =
System.IO.Path.GetExtension(FullFileName);
if (extension == ".igs")
{
System.Windows.Forms.
MessageBox.Show("saving to a .igs file");
}
else if (extension == ".jpg")
{
System.Windows.Forms.
MessageBox.Show("saving to a .jpg file");
}
HandlingCode =
HandlingCodeEnum.kEventNotHandled;
}