It sound like you want to change the members within the iAssembly factory. The rule below does that and it also does it for an iPart factory as well. I have left in commenting to show you what can be done with the rule. If you are looking to change iProperties via the rule you will need additional pieces of code to get around system generating messages.
Here are a few links that help me generate the below.
https://forums.autodesk.com/t5/inventor-customization/automate-idw-drawing-file-creation-for-all-ipa...
http://inventortrenches.blogspot.com/2013/03/determine-file-type-for-ilogic-rule.html
Sub Main
Check = MessageBox.Show("Loop through factory members, This will take a while. Are you sure?" _
, "Ilogic Instructions", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
If Check = vbYes Then
Dim oDoc As Document
oDoc = ThisDoc.Document
If oDoc.DocumentType = Inventor.DocumentTypeEnum.kPartDocumentObject Then
'Check if ODoc is a Part Document
'MessageBox.Show("This is a part file.", "iLogic")
'Set a reference to the component definition
oDef = ThisApplication.ActiveEditDocument.ComponentDefinition
'Make sure we have an iPart factory.
If oDef.IsiPartFactory = False Then
MsgBox ("Chosen document is not a factory.", vbExclamation)
Exit Sub
End If
' Set a reference to the factory.
Dim oFactory As iPartFactory
oFactory = oDef.iPartFactory
'Get the number of rows in the factory.
Dim iNumRows As Integer
iNumRows = oFactory.TableRows.Count
Dim iRow As Integer
'Set iRow = First Member
oStart = InputBox("Pick a Start Row", "Member Start Row#", 1)
oEnd = InputBox("Pick a Start Row", "Member Start Row#", iNumRows)
If oStart = "" Then
If oEnd = "" Then
Exit Sub
End If
End If
For iRow = oStart To oEnd
'Change ipart Row
iPart.ChangeRow("", iRow)
'Use if memberfile name needed
MemberFileName = oFactory.FileNameColumn(iRow).Value
MessageBox.Show(MemberFileName, "Title")
'[---Call external "function" or rule or do something--
'Use if required
'ThisDoc.Document.Rebuild()
'Create each member
' Try
' Call oFactory.CreateMember
' Catch
' MessageBox.Show("Error creating Member", "iLogic")
' End Try
Next
iLogicVb.UpdateWhenDone = True
'open folder
'oFolder = ThisDoc.Path &"\" & ThisDoc.FileName(False)
'Call Shell("explorer.exe" & " " & oFolder, vbNormalFocus)
ElseIf oDoc.DocumentType = Inventor.DocumentTypeEnum.kAssemblyDocumentObject Then
'Check if ODoc is a Part Document
'MessageBox.Show("This is a Assembly file.", "iLogic")
'Set a reference to the component definition
oDef = ThisApplication.ActiveEditDocument.ComponentDefinition
'Make sure we have an iPart factory.
If oDef.IsiAssemblyFactory = False Then
MsgBox ("Chosen document is not a factory.", vbExclamation)
Exit Sub
End If
' Set a reference to the factory.
Dim oFactory As iAssemblyFactory
oFactory = oDef.iAssemblyFactory
'iPartF = oDef.iPartMember.ParentFactory
'Get the number of rows in the factory.
Dim iNumRows As Integer
iNumRows = oFactory.TableRows.Count
Dim iRow As Integer
'Set iRow = First Member
oStart = InputBox("Pick a Start Row", "Member Start Row#", 1)
oEnd = InputBox("Pick a Start Row", "Member End Row#", iNumRows)
If oStart = "" Then
If oEnd = "" Then
Exit Sub
End If
End If
For iRow = oStart To oEnd
'Change iassembly Row
iAssembly.ChangeRow("", iRow)
'Use if memberfile name needed
MemberFileName = oFactory.FileNameColumn(iRow).Value
MessageBox.Show(MemberFileName, "Title")
'[---Call external "function" or rule or do something---
'Use if required
'ThisDoc.Document.Rebuild()
'Create each member
' Try
' Call oFactory.CreateMember
' Catch
' MessageBox.Show("Error creating Member", "iLogic")
' End Try
Next
iLogicVb.UpdateWhenDone = True
'open folder
'oFolder = ThisDoc.Path &"\" & ThisDoc.FileName(False)
'Call Shell("explorer.exe" & " " & oFolder, vbNormalFocus)
End If
Else
End If
End Sub
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan