iLogic rules from 2019 to 2020

iLogic rules from 2019 to 2020

Anonymous
Not applicable
911 Views
6 Replies
Message 1 of 7

iLogic rules from 2019 to 2020

Anonymous
Not applicable

In the Inventor 2019 version this rule works correctly, but in the Inventor 2020 version the rule does not work correctly, it does not perform the "Try" part.

Why?

 

Rules:

Dim oComps As DocumentsEnumerator
oComps = ThisApplication.ActiveDocument.AllReferencedDocuments
Dim oComp As Document
    For Each oComp In oComps
	Try 
		iLogicVb.RunRule(oComp.DisplayName & ":1", "Tempo")
	Catch
		ThisApplication.Documents.Open(oComp.FullFileName)
		ThisApplication.Documents.Open(oComp.FullFileName).Close
	End Try
	Next

 

0 Likes
Accepted solutions (1)
912 Views
6 Replies
Replies (6)
Message 2 of 7

WCrihfield
Mentor
Mentor

Have you checked your iLogic Rule Editor dialog Options tab to check if "Don't run Automatically", "Silent Operation", and Fire Dependant Rules Immediately" are checked?

iLogic Rule Editor Options screen capture.PNG

Also try "Reginerate All Rules tool, after the new install.

Also check these settings.

iLogicAuto.RulesEnabled = True
iLogicAuto.RulesOnEventsEnabled = True
Dim oRegenAllRules As ControlDefinition = ThisApplication.CommandManager.ControlDefinitions.Item("iLogic.RegenAllRules")
oRegenAllRules.Execute2(True)
iLogicVb.DocumentUpdate

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 7

CattabianiI
Collaborator
Collaborator

What does "does not perform" mean?
if you add a MsgBox("foo") before RunRule do you get the message?
and if you add MsgBox(oComp.DisplayName)

Who did write this rule? Do you know what those lines mean?
oComp.DisplayName is the file name with extension by default, I hope you don't name your occurrences with file extension.

I'm pretty sure that doesn't work in Inventor 2019 either. 

0 Likes
Message 4 of 7

mcgyvr
Consultant
Consultant

Did you verify that the Tempo rule is in each part file?



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes
Message 5 of 7

WCrihfield
Mentor
Mentor

Also, I believe that it may be possible that not all ReferencedDocuments in every file are going to be "native" Inventor documents.

ReferencedDocuments.Item(1) is seen as "_Document", not just regular "Document".  If one of the ReferencedDocuments was some other type of document, it would throw an error.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 7

Curtis_Waguespack
Consultant
Consultant

Hi @Anonymous 

 

Welcome to the forum.

 

A couple of quick tips:

 

  • With Inventor 2019 and 2020 (maybe 2018? i can't recall).. you can use the ilogic Logger to report information as your rule runs.
  • For trouble shooting add Catch Ex as Exception and then return that to the ilogic Logger as in this example to show you what the Try/Catch issue is... see example below

 

Click the + sign as shown, and then select iLogic Log to bring up the logger

 

image.png

 

image.png

 

 

Dim oComps As DocumentsEnumerator
oComps = ThisApplication.ActiveDocument.AllReferencedDocuments
Dim oComp As Document

For Each oComp In oComps
	Logger.Info(oComp.FullFileName)
	Try 
		iLogicVb.RunRule(oComp.DisplayName & ":1", "Tempo")
		Logger.Info("Rule was run")
	Catch ex As Exception
		Logger.Error(ex.Message)
		ThisApplication.Documents.Open(oComp.FullFileName)
		Logger.Info("File Opened")
		ThisApplication.Documents.Open(oComp.FullFileName).Close
		Logger.Info("File Closed")
	End Try
Next

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 7 of 7

Anonymous
Not applicable
Accepted solution

Thanks everyone for your advice. It was helpful that made me understand the error, so I decided to solve it.

 

Dim oComps As DocumentsEnumerator
oComps = ThisApplication.ActiveDocument.AllReferencedDocuments
Dim oComp As Document
    For Each oComp In oComps
	Try 
		'iLogicVb.RunRule(oComp.DisplayName & ":1", "Tempo")
iLogicVb.RunRule(oComp.DisplayName, "Tempo") Catch ThisApplication.Documents.Open(oComp.FullFileName) ThisApplication.Documents.Open(oComp.FullFileName).Close End Try Next

Thank you

0 Likes