iLogicVb.Automation.DeleteAllRulesInDocument(oDoc) Causing Catastrophic Failure Error In Inventor 2025

iLogicVb.Automation.DeleteAllRulesInDocument(oDoc) Causing Catastrophic Failure Error In Inventor 2025

mjuengel
Participant Participant
234 Views
13 Replies
Message 1 of 14

iLogicVb.Automation.DeleteAllRulesInDocument(oDoc) Causing Catastrophic Failure Error In Inventor 2025

mjuengel
Participant
Participant

I have an iLogic rule that ran fine when using Inventor 2023, but after updating to 2025, it produces a catastrophic error.  I have narrowed down the offending line of code to the following:

iLogicVb.Automation.DeleteAllRulesInDocument(oDoc)

 

The error does not occur until the rule finishes and everything appears to be working, so I am confused why there is an error message.

0 Likes
235 Views
13 Replies
Replies (13)
Message 2 of 14

MjDeck
Autodesk
Autodesk

Hi @mjuengel - can you provide more details, and maybe a test model? If you can't share them on the forum, please send me a private message.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 3 of 14

mjuengel
Participant
Participant

I really can't share the exact code as this is part of a confidential project.  The code is at the end of the rule and appears to run correctly.  The SaveAs works with the file closing the file with the rules deleted, but the error box appears right after the document is opened (ThisApplication.Documents.Open(oPathName)).  If I remove the "iLogicVb.Automation.DeleteAllRulesInDocument(oDoc)", then there is no error, but the rules are not deleted.

 

        Dim fPathName As String
	Dim oDoc As Document
	Dim iLogicAuto As Object
	Auto = iLogicVb.Automation
	iLogicAuto = Auto
	iLogicVb.Automation.DeleteAllRulesInDocument(oDoc)
	oDoc.SaveAs(fPathName, False) 'True = Save As Copy & False = Save As
	ThisDoc.Document.Close(True)
	On Error Resume Next
	ThisApplication.Documents.Open(oPathName)
	On Error GoTo 0

 

0 Likes
Message 4 of 14

MjDeck
Autodesk
Autodesk

Thanks for reporting this. I can see the problem. It is a bug in iLogic. I created internal issue INVGEN-85927.

You could work around it by running that rule as an external rule, instead of storing it in the document. Would that be compatible with your workflow?


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 5 of 14

mjuengel
Participant
Participant
I will work on that approach.

Thank you
0 Likes
Message 6 of 14

mjuengel
Participant
Participant

I did try implementing the code in an external rule, and I get the same error message.  Can you confirm it does the same for you?

0 Likes
Message 7 of 14

MjDeck
Autodesk
Autodesk

I haven't tried, but I expect I would get the same error.
My idea was to implement it in an external rule and also: do not call that external rule from a rule in the document. Instead, change your workflow so that the whole operation is done from an external rule.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 8 of 14

mjuengel
Participant
Participant

What do you mean by "change your workflow"?

0 Likes
Message 9 of 14

MjDeck
Autodesk
Autodesk

When I say workflow, I mean the steps you take to run that internal rule that deletes the rules and does the SaveAs.
What are the steps you take to run it? Do you run it manually from the iLogic browser?


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 10 of 14

mjuengel
Participant
Participant

I can run it by manually running an internal rule to set the file name, and then manually running the external rule to change the model and do a save as.  No error message this way.  Do you have any idea when I can expect the issue to be corrected, so I won't have to manually run 2 rules?

0 Likes
Message 11 of 14

MjDeck
Autodesk
Autodesk

What is in the internal rule? Maybe it can be added to the external rule instead.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 12 of 14

mjuengel
Participant
Participant

It could, but there will be multiple models that use the code.  This will result in multiple external rules, one for each of the different models.  Please let me know when Autodesk fixes the issue.  Thank you

0 Likes
Message 13 of 14

MjDeck
Autodesk
Autodesk

We might be able to release a fix on September 9. If not, it would be in December.

Are you sure you can't do everything in a single external rule? An external rule can read parameters, iProperties, and the filename from any document that you run it on.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 14 of 14

mjuengel
Participant
Participant

I could, but then I would have to have multiple external rules for each model type that would use it.  We will manually run 2 rules and wait for the fix.

Thank you

0 Likes