Not exactly sure how you wanted to handle the selection portion of your request, but I do actually have something that you could likely start with, which matches your request pretty closely. It lets the user either 'pre-select' assembly components, or if nothing was pre-selected, it lets the user manually select some assembly components after the rule starts. It then attempts to get the Document object that the components are referencing, and tries to run an external rule on that referenced document. You will obviously need to change the name of the external rule within this code before trying it out though.
And I also agree with what @C_Haines_ENG said about the contents of the external iLogic rule that this rule will be running. There are many uniquely iLogic rule objects which try to do tasks in a simpler than usual way, either do not offer a way to specify which document you want it to be focusing on, or offer difficult to understand/use ways of specifying a component or document for it to focus on. Then there is which document it will focus on when no document is specified, which changes in different situations. Its all a bit too difficult to explain in one place, but document references become much more critical within external iLogic rules, especially ones that will be ran remotely (due to events triggering them to run, or running them from another document). This example I have provided offers the most ways to indicate which document you want the 'other' rule to be focused on, but it can not 'force' your other rule to use those tactics/resources. The other rule has to be designed in a way to work with them.
Sub Main
Dim oInvApp As Inventor.Application = ThisApplication
Dim oADoc As AssemblyDocument = TryCast(ThisDoc.Document, Inventor.AssemblyDocument)
If oADoc Is Nothing Then Return
Dim oSS As Inventor.SelectSet = oADoc.SelectSet
Dim oSelected_Occs As New List(Of Inventor.ComponentOccurrence)
For Each oSSObj In oSS
If TypeOf oSSObj Is Inventor.ComponentOccurrence Then
oSelected_Occs.Add(oSSObj)
End If
Next
If oSelected_Occs.Count = 0 Then
Dim oCmdMgr As Inventor.CommandManager = oInvApp.CommandManager
Dim oFilter = SelectionFilterEnum.kAssemblyOccurrenceFilter
Dim sPrompt As String = "Select Component - Or Press Esc Key To Exit"
Dim oPickedOcc As Inventor.ComponentOccurrence = Nothing
Do
oPickedOcc = Nothing
oPickedOcc = oCmdMgr.Pick(oFilter, sPrompt)
If oPickedOcc Is Nothing Then Exit Do
oSelected_Occs.Add(oPickedOcc)
Loop Until oPickedOcc Is Nothing
End If
Dim sRuleName As String = "EXTERNAL RULE NAME HERE" '<<< CHANGE THIS >>>
Dim oAuto As IiLogicAutomation = iLogicVb.Automation
Dim oArgs As Inventor.NameValueMap = oInvApp.TransientObjects.CreateNameValueMap()
oArgs.Add("Document", Nothing)
For Each oSelOcc As Inventor.ComponentOccurrence In oSelected_Occs
Dim oOccRefDoc As Inventor.Document = Nothing
Try : oOccRefDoc = oSelOcc.ReferencedDocumentDescriptor.ReferencedDocument : Catch : End Try
If oOccRefDoc Is Nothing Then Continue For
oArgs.Value("Document") = oOccRefDoc
oAuto.RunExternalRuleWithArguments(oOccRefDoc, sRuleName, oArgs)
Next
oADoc.Update2(True)
End Sub
Wesley Crihfield

(Not an Autodesk Employee)