iLogic to sort part lists in entire document

iLogic to sort part lists in entire document

GKPByDesign
Advocate Advocate
386 Views
1 Reply
Message 1 of 2

iLogic to sort part lists in entire document

GKPByDesign
Advocate
Advocate

I have some iLogic which I didn't write, but wish to modify to cycle all pages in an active open drawing, can someone help 

 

'start of iLogic code----------------------------------------------------------------------------------
'sort parts list
on error resume next
Dim oDrawDoc As DrawingDocument
oDrawDoc = ThisApplication.ActiveDocument

Dim oPartsList1 As PartsList
oPartsList1 = oDrawDoc.ActiveSheet.PartsLists.Item(1)
'If oPartsList1 Is Nothing Then Resume Next

oPartsList1.Sort("PART NUMBER")
oPartsList1.Renumber
0 Likes
Accepted solutions (1)
387 Views
1 Reply
Reply (1)
Message 2 of 2

Sergio.D.Suárez
Mentor
Mentor
Accepted solution

Hi, To order all partslist of the drawing document, I think I could use a code like the following. 

 

Dim oDrawDoc As DrawingDocument = ThisApplication.ActiveDocument

For Each oSheet As Sheet In oDrawDoc.Sheets
	On Error Resume Next
	For Each oPartsList As PartsList In oSheet.PartsLists
		oPartsList.Sort("PART NUMBER")
		oPartsList.Renumber
	Next
Next

 It will pass through all the sheets of the drawing file.
I hope this helps with your problem. regards


Please accept as solution and give likes if applicable.

I am attaching my Upwork profile for specific queries.

Sergio Daniel Suarez
Mechanical Designer

| Upwork Profile | LinkedIn