I believe I know why it is doing that. I did some local testing and saw a similar message. I had forgotten that when specifying an external rule, it seems to need a little extra text before the rule name before setting it to the value of the property. This is not needed when working with local rules. The extra text is "file://". So, the quickest way to fix this would be to manually open those components, delete this rule from the Event Triggers, then within this rule, simply add "file://" in front of the rule name when you specify the name of an external rule before you run it again. The next longer way to fix the situation would be to alter this rule to have it attempt to find & replace the rule name in the property with the altered rule name.
The longer/proper fix that I am going to implement in my own solutions to make them more dynamic is the following:
I created another little routine to add into the rule that will check if the rule name you specify is a 'local' rule or an 'external' rule, and when it is an external rule, it will automatically add that little extra text to the start of the specified rule name, before it attempts to set it as the value of the property.
Near the end of the main Sub, but just before the following lines:
'try to put the specified rule into Event Triggers of Part under the specified event
AddRuleToEventTriggers(oEventTriggers, oRuleName, oEventName)
Add the following lines:
'if rule is external rule, add "file://" to the start of the name
If RuleIsExternal(oPDoc, oRuleName) Then
oRuleName = "file://" & oRuleName
End If
That will run the custom Function below, that you are about to add.
Then add the following custom Function code on the next line after the "End Sub" of the main sub.
Function RuleIsExternal(oDoc As Document, oRule As String) As Boolean
'check for the rule in the 'active' document, 'local' document, and supplied 'target' document
' if not found, it is assumed to be external
Dim iRule As iLogicRule
Dim oAuto As IiLogicAutomation = iLogicVb.Automation
Try
iRule = oAuto.GetRule(oDoc, oRule)
Catch
iRule = oAuto.GetRule(ThisApplication.ActiveDocument, oRule)
Catch
iRule = oAuto.GetRule(ThisDoc.Document, oRule)
Catch
Return True
End Try
If IsNothing(iRule) Then Return True Else Return False
End Function
It would take a lot of time to explain why, but it is possible that 'ThisDoc.Document', and 'ThisAppliacion.ActiveDocument', and the document being passed to this Function may all be referring to different documents, so it checks all of them to see if the specified rule name is found in any of them. If it is not found in any of them, it then assumes it is an external rule. The Function returns True if it is an external rule, and False if it is a local rule. Then that earlier code which runs this Function, checks the returned value, then applies the extra text to the front of the name when it's True.
Wesley Crihfield
(Not an Autodesk Employee)