Hi @t.office. I think I have figured out a way to make this happen for you. In your original post, you mentioned that you are exporting something to a DWG file type. I assume the 'original' file that you are exporting from is a regular Inventor IDW drawing file, correct? If that is not correct, then the solution I am providing here may not work for you without further modifications. This iLogic rule solution is a rather complex one. After you run this rule, it will create and launch a custom event handler that will remain running in the background, listening for the event of 'translating a document', until you close Inventor. When this event is triggered, this block of code has to check several things about the event before it will react to it, because it covers a lot of different types of import / export operations and file types. If the event is for importing, instead of exporting, it will not do anything else. If the 'original' file's name does not end with ".idw", it will not do anything else. If the file name of the resulting file it is about to create does not end with ".dwg", it will not do anything else. If it passes all those tests, it must be for exporting an IDW file to a DWG file. Then it attempts to open that original drawing invisibly (in the background), then checks its Creation Date iProperty against today's date, and only if it does not match, it will try to change it to todays date. Then it will attempt to update the drawing. Then it will attempt to save the drawing again. Then, if it did that, it will write a message to the iLogic Log window about it. All that code so far will only run just 'before' the file is exported, not afterwards. Then I left some code in the 'After' side of the event that just writes something to the iLogic Log window after the event. But that 'After' part will be carried out for all import or export operations. If you do not want that part, you can either comment it out, or delete it (just don't delete the final 'End If' line before the 'End Sub' line.
Caution: I have not tested this code yet, so if you run it, and it is not functioning correctly, you may need to close Inventor, then restart Inventor, to get rid of the event handler it creates.
Sub Main
oAppEvents = ThisApplication.ApplicationEvents
AddHandler oAppEvents.OnTranslateDocument, AddressOf oAppEvents_OnTranslateDocument
End Sub
Dim oAppEvents As Inventor.ApplicationEvents
Sub oAppEvents_OnTranslateDocument(TranslatingIn As Boolean, DocumentObject As Document, _
FullFileName As String, BeforeOrAfter As EventTimingEnum, Context As NameValueMap, _
ByRef HandlingCode As HandlingCodeEnum)
If BeforeOrAfter = EventTimingEnum.kBefore Then
If TranslatingIn = True Then Exit Sub 'we only want to respond when exporting (translating out)
If FullFileName.EndsWith(".idw") = False Then Exit Sub 'FullFileName is for the 'original' file
If Context.Count = 0 Then Exit Sub 'if no Context to review, exit routine
Dim TargetData As Inventor.DataMedium = Nothing
Try : TargetData = Context.Value("TargetData") : Catch : End Try
If TargetData Is Nothing Then Exit Sub
If TargetData.MediumType = MediumTypeEnum.kFileNameMedium Then
Dim sDestinationFullFileName As String = TargetData.FileName
If sDestinationFullFileName.EndsWith(".dwg") Then 'check if exporting to a DWG file type
Dim oDDoc As DrawingDocument = Nothing
Try : oDDoc = ThisApplication.Documents.Open(FullFileName, False) : Catch : End Try
If oDDoc Is Nothing Then Exit Sub
Dim oCDateProp As Inventor.Property = oDDoc.PropertySets.Item(3).Item(1)
If oCDateProp.Value <> Today Then
Try : oCDateProp.Value = Today : Catch : End Try
If oDDoc.RequiresUpdate Then Try : oDDoc.Update2(True) : Catch : End Try
If oDDoc.Dirty Then Try : oDDoc.Save2(False) : Catch : End Try
End If
Try : oDDoc.ReleaseReference : Catch : End Try
Logger.Info("Checked / Updated Creation Date of following IDW file before export to DWG file:"& vbCrLf & FullFileName)
End If
End If
ElseIf BeforeOrAfter = EventTimingEnum.kAfter Then
If DocumentObject IsNot Nothing Then
Logger.Info(FullFileName & vbCrLf & "...was just translated to:" & vbCrLf & DocumentObject.FullFileName)
End If
End If
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)