Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

iLogic - Runtime rules just after opening document 7x slower than 2, 3, enz. run

r.jacobsXGCG6
Observer

iLogic - Runtime rules just after opening document 7x slower than 2, 3, enz. run

r.jacobsXGCG6
Observer
Observer

Hello,

 

We are migrating from Inventor 2017 to 2021. We have built the 2021 templates and design data from scratch up.

Also made some changes to the iLogic rules we used. All fine so far.

 

Now we are performing speedtest compairation from 2017 to 2021. And we discoverd a huge difference in run time from the iLogic. Whe have discoverd that it is the first time a rule is runned in a part / assembly that it takes up to 7 times the runtime in compairation to the second or third time the rule is triggerd. When we close the part / assemby and open it. The first runtime is also 7 times slower. Same results.

 

This is the same in Inventor 2020.

In Inventor 2017 the difference is around 2x.

 

Is this a known issue?

 

We have scriped a performance test tool which does not include storage time. So we are logging only the time it takes to run the rule.

 

Class BOMiLogicRules

	'Global variabelen

	Dim RuleName As String = "Performance Test"

	Dim oDoc As Document
	Dim oStopwatch As System.Diagnostics.Stopwatch = New System.Diagnostics.Stopwatch

	Sub Main()

		oDoc = ThisDoc.Document
		If oDoc.IsModifiable = False Then
			Return 'is Read-only
		End If

		Dim oTransaction As Transaction = ThisApplication.TransactionManager.StartTransaction(ThisApplication.ActiveDocument, oDoc.FullFileName.ToString.Split("\").Last.Split(".").First & ": " & RuleName) 'Start a transaction (Combines everything in single command, and therefore a single undo command as well)
		Logger.Info("Run Rule: " & oDoc.FullFileName.ToString.Split("\").Last.Split(".").First & ": " & RuleName & " " & DateTime.Now)
		Try


			Dim Iterations_Part As Integer = 1
			Dim Iterations_Assembly As Integer = 1
Assembly_Save(Iterations_Assembly) Catch oException As Exception Logger.Error("Message: " & oException.Message) Logger.Error("HelpLink: " & oException.HelpLink) Logger.Error("Source: " & oException.Source) Logger.Error("StackTrace: " & oException.StackTrace) Logger.Error("TargetSite: " & oException.TargetSite.ToString) oTransaction.Abort() 'Abort transaction and undo everything Return End Try oTransaction.End() 'End the transaction End Sub
Sub Assembly_Save(ByVal Iterations As Integer) Dim TotalElapsedMilliseconds As Integer = 0 For i = 1 To Iterations Step 1 For Each xDoc As Document In oDoc.AllReferencedDocuments If xDoc.IsModifiable = True Then xDoc.PropertySets.Item("Inventor Summary Information").Item("Comments").Value = i End If Next oStopwatch.Restart For Each xDoc As Document In oDoc.ReferencedDocuments xDoc.Save() Next oStopwatch.Stop TotalElapsedMilliseconds += oStopwatch.ElapsedMilliseconds logger.info("RunRule: " & oiLogicRuleName & " // " & oStopwatch.ElapsedMilliseconds) Next logger.info("Result: /rule:" & oiLogicRuleName & " /iterations:" & Iterations & " /avg:" & Math.Round(TotalElapsedMilliseconds / Iterations, 0) & "ms") End Sub End Class

 

Whe have also made a test assembly from Inventor 2021 default templates. 10 parts, and add two iLogic rules each part:

1 Before Save

1 After Save

 

The rules are empty exept a logger info so we can see that the rule has runned on a part.

 

logger.Info("Hello After Save" & iProperties.Value("Project", "Part Number"))

Also than it takes up to 7 times more runtime for the first run after opening a document.

 

First run 2021:

INFO| 91: >>---------------------------
INFO|Run Rule: Assembly1: Performance Test 24-3-2021 09:32:37
INFO|Hello Before Save Part10
INFO|Hello After Save Part10
INFO|Hello Before Save Part9
INFO|Hello After Save Part9
INFO|Hello Before Save Part8
INFO|Hello After Save Part8
INFO|Hello Before Save Part7
INFO|Hello After Save Part7
INFO|Hello Before Save Part6
INFO|Hello After Save Part6
INFO|Hello Before Save Part5
INFO|Hello After Save Part5
INFO|Hello Before Save Part4
INFO|Hello After Save Part4
INFO|Hello Before Save Part3
INFO|Hello After Save Part3
INFO|Hello Before Save Part2
INFO|Hello After Save Part2
INFO|Hello Before Save Part1
INFO|Hello After Save Part1
INFO|RunRule: // 4638
INFO|Result: /rule: /iterations:1 /avg:4638ms
INFO| 92: >>---------------------------

 

Second run 2021:
INFO|Run Rule: Assembly1: Performance Test 24-3-2021 09:32:52
INFO|Hello Before Save Part10
INFO|Hello After Save Part10
INFO|Hello Before Save Part9
INFO|Hello After Save Part9
INFO|Hello Before Save Part8
INFO|Hello After Save Part8
INFO|Hello Before Save Part7
INFO|Hello After Save Part7
INFO|Hello Before Save Part6
INFO|Hello After Save Part6
INFO|Hello Before Save Part5
INFO|Hello After Save Part5
INFO|Hello Before Save Part4
INFO|Hello After Save Part4
INFO|Hello Before Save Part3
INFO|Hello After Save Part3
INFO|Hello Before Save Part2
INFO|Hello After Save Part2
INFO|Hello Before Save Part1
INFO|Hello After Save Part1
INFO|RunRule: // 628
INFO|Result: /rule: /iterations:1 /avg:628ms

 

 

 

0 Likes
Reply
277 Views
2 Replies
Replies (2)

bradeneuropeArthur
Mentor
Mentor

Hi,

Is this an external rule?

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

0 Likes

r.jacobsXGCG6
Observer
Observer

Hi,

 

The before en after save rules are internal in the parts.

 

The tool runs external from de D-drive. But when we manualy change the comment property en forse a save to al documents we get the same results.

0 Likes