Message 1 of 5
Rule added to event trigger by another rule is not triggering
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I have written this rule that adds another rule into event trigger. The problem is that the event trigger is not triggering the rule. I have to close the document, then reopen it and it works. Also if I add the rule manually, it is working okay.
I really need to make the event trigger working without having to close the document. Before that I do another things by another rules and sometimes they do it wrong, so I can not just save the document, close it and reopen it.
Code:
Dim oDoc As Document = ThisApplication.ActiveDocument Dim oRuleName As String = "Rule_to_add" Dim oAuto As IiLogicAutomation = iLogicVb.Automation Dim oRule As iLogicRule Try oRule = oAuto.GetRule(oDoc,oRuleName) Catch MsgBox("The specified rule was not found in the active document. Exiting.",vbOKOnly," ") Exit Sub End Try Dim oEventsPropSet As Inventor.PropertySet Dim oSetName As String = "iLogicEventsRules" Dim oInternalName As String = "{2C540830-0723-455E-A8E2-891722EB4C3E}" Try oEventsPropSet = oDoc.PropertySets.Item(oSetName) Catch oEventsPropSet = oDoc.PropertySets.Add(oSetName,oInternalName) End Try If oEventsPropSet Is Nothing Then oEventsPropSet = oDoc.PropertySets.Add(oSetName, oInternalName) End If Dim oProperty As Inventor.Property Dim oPropId As Integer For oPropId = 1600 To 1699 Try oProperty = oEventsPropSet.ItemByPropId(oPropId) If oProperty.Value = oRuleName Then Exit Sub End If Catch oProperty = oEventsPropSet.Add(oRuleName, "AfterAnyiPropertyChange" & oPropId, oPropId) Exit Sub End Try oPropId = oPropId + 1 Next
I do it in drawing, I am using Inventor Professional 2020 64 bit, Build 396.
I appreciate your help, thank you in advance.