Hi @Marx_Qshi. Have you already tried the usual iLogic/Inventor API methods for that task yet? Below is an example iLogic rule you can try out for that task. When ran, it checks if the active document is a drawing, and if not, it just exits the rule, because it can only work on a drawing. Then it gets a reference to the active sheet of the drawing. Then it checks if there are any PartsList objects on that sheet. If there are none, it exits the rule, because there is nothing for it to do. If at least one is found, it gets the first one. Then it attempts to sort the contents of the PartsList by the values it finds within the primary column "PART NO", in ascending order. Then it will try to renumber the rows.
Sub Main
If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then Return
Dim oDDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Inventor.Sheet = oDDoc.ActiveSheet
Dim oPLists As PartsLists = oSheet.PartsLists
If oPLists.Count = 0 Then Return
Dim oPList As PartsList = oPLists.Item(1)
oPList.Sort2("PART NO", True, , , , , True, False)
oPList.Renumber()
oSheet.Update
oDDoc.Update
End Sub
If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.
Wesley Crihfield

(Not an Autodesk Employee)