Reorder the bom list in drawing

Reorder the bom list in drawing

Marx_Qshi
Explorer Explorer
418 Views
2 Replies
Message 1 of 3

Reorder the bom list in drawing

Marx_Qshi
Explorer
Explorer

Hi 

 I want to reorder the Bom list in drawing. the sort of keyword is "PART NO". After sort the PART NO, I want to sort the "S/N" list from 1 to end, the step should be 1.

 

the example like this

309895004_0-1702873011949.png

this is what need to change Bom list.

309895004_1-1702873378112.png

 

0 Likes
Accepted solutions (1)
419 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor
Accepted solution

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

EESignature

(Not an Autodesk Employee)

Message 3 of 3

Marx_Qshi
Explorer
Explorer
It works, thank you.
0 Likes