Inventor 2025 "The file was modified by a rule that ran on check-in."

Inventor 2025 "The file was modified by a rule that ran on check-in."

trohar
Participant Participant
372 Views
1 Reply
Message 1 of 2

Inventor 2025 "The file was modified by a rule that ran on check-in."

trohar
Participant
Participant

We run an iLogic code to tidy a bunch of things in files. Ideally it would be good to run this rule on Check-in but when doing so the error "The file was modified by a rule that ran on check-in." is thrown. Reading this article "The file was modified by a rule that ran on check-in." when check-in a file to Vault from Inventor it states this is intended behavior. Unfortunately for us running the rule on Save does not make sense as the rule Alpha Sorts Components, Sorts BOM, Returns view to home view, turns off work planes and axis, just a bunch of general house keeping. Running all of this on every save would not work and mess up the users work flow but having files tidied before check in makes sense. Is there anyway to turn off this error?

0 Likes
373 Views
1 Reply
Reply (1)
Message 2 of 2

g.georgiades
Advocate
Advocate

Hi @trohar 

 

From what I can tell, it is not possible to turn off that error.

 

I did some limited testing to bypass it and am seeing results.

 

 

Your first option is in the Before Save Trigger rule - you can check if the running command is the checkin command

Try
	Logger.Info(ThisApplication.CommandManager.ActiveCommand)
Catch
	Logger.Info("No active command")
	Exit Sub
End Try

If ThisApplication.CommandManager.ActiveCommand = "VaultCheckin" Then
	Dim doc As DrawingDocument = ThisDoc.Document
	Dim r As New Random
	Dim pt As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(8*2.54*r.NextDouble(), 11*2.54*r.NextDouble())
	doc.Sheets.Item(1).DrawingNotes.GeneralNotes.AddFitted(pt, "Test")
	ThisDoc.Save
End If

 

However, this has two drawbacks. If you manually save the document, before running checkin, then it will not run. And when it does run - it may have unexpected behavior when unsaved children are also unsaved. It also likes to popup a save unseccssful prompt sometimes, so the checkin has to be run twice to get it to work.

 

 

A more reliable method is to add an event handler to the ActivateCommand event which is best done via an addin

https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=UserInputEvents_OnActivateCommand

 

You put essentially the same code as above in that event handler, and it will run and save the document BEFORE the checkin dialog shows up. This differs from the iLogic Before Vault Checkin Trigger where it runs after the checkin dialog shows up and the user clicks ok. It seems to not prompt a save unsucessful window, but I have not done much testing on it.

 

You may be able to set up the event handler in a purley iLogic way, but that will have its own issues which is why addins are preferred when working with event handlers.

 

Please let me know if you are able give an addin a shot.

0 Likes