Hi @Anonymous,
The solution provided by @jdkriek will obviously work for a generic situation.
What you need is to sort the parts list by vendor and part number then iterate through each row checking whether the current row's vendor matches the next one.
If it doesn't, add the blank rows as per the above like this:
Public Sub Main()
Dim trans as transaction = ThisApplication.TransactionManager.StartTransaction(ThisApplication.ActiveDocument,"Add Blank Rows")
Try
Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument
Dim oPartList As PartsList = oDrawDoc.ActiveSheet.PartsLists.Item(1)
oPartList.Sort("VENDOR",True,"PART NUMBER",True)
Dim i As Long = 1
For i = 1 To 500
Dim thisCell As PartsListCell = oPartList.PartsListRows.Item(i).Item("VENDOR")
If Not thisCell.Value = "" Then
Dim nextrowint As Integer = i + 1
If nextrowint > oPartList.PartsListRows.Count Then Exit For
Dim nextCell As PartsListCell = oPartList.PartsListRows.Item(nextrowint).Item("VENDOR")
If Not thisCell.Value = nextCell.Value Then
oPartList.PartsListRows.Add(i, False)
oPartList.PartsListRows.Add(i, False)
oPartList.PartsListRows.Add(i, False)
End If
End If
Next
oPartList.Renumber
oPartList.SaveItemOverridesToBOM
Catch
trans.Abort()
Finally
trans.End()
End Try
End Sub
Because I wanted the rule to run inside a transaction which makes it easy to undo, I had to remove the "On Error Resume Next" line. This meant I had to include a check for whether the nextrow was larger than the number of available rows in the parts list and exit the loop if so.
Cheers,
Alex.