iLogic PartsList sort by part number style, then by part number

iLogic PartsList sort by part number style, then by part number

drafting03_AR
Contributor Contributor
547 Views
4 Replies
Message 1 of 5

iLogic PartsList sort by part number style, then by part number

drafting03_AR
Contributor
Contributor

We have two part numbering standards - 1 for manufactured parts and 1 for purchased parts. What I would like is for all of the purchased parts to be at the bottom of the PartsList. Our part numbers are like this:

 

XXX-XXXXX for purchased parts

XXXXXR for manufactured parts, where "R" is the revision number

 

Ideally, what I am trying to do is search for part numbers that are greater than 6 digits long and sort them at the bottom of the PartsList. Alternatively, I could search the part number for "-" and then sort them at the bottom of the PartsList.

 

My current solution, which is not ideal, is that I add "Purchased" into an iProperty for all the purchased parts, add that column to the parts list, sort by that column, then by part number and then reduce the column width of that particular iProperty to 0, so it doesn't actually appear on the PartsList.

 

I do all this with iLogic but the issue is that I would have to go back and add this iProperty to all our existing purchased part models (and content center families) and make sure that everyone remembers to fill this field when creating new purchased part models.

0 Likes
548 Views
4 Replies
Replies (4)
Message 2 of 5

dgreatice
Collaborator
Collaborator

Hi,

 Capture1.JPG

1. Are you set BOM to purchased parts?

2. You want to sort all in Main Assembly?, are Strurctured status are Enable? or You use Part Only(Enable) see BOM window for clarify.

 

You can use "BOMStructure" for find you part.

 

example:

 

For Each oBomrow in oBomView.BomRows

If oBomRow.BOMStructure = kPurchasedBOMStructure Then

'next code for sorting
End If

next

 

 

Please use the ACCEPT AS SOLUTION or KUDOS button if my Idea helped you to solve the problem.

Autodesk Inventor Professional Certified 2014
0 Likes
Message 3 of 5

Anonymous
Not applicable

HI @drafting03_AR

 

Did you ever figure out how to sort the parts list?

 

I am looking to do something similar, I would like to sort my parts list based on the length of the part number.

ie 13 digit numbers displayed at the top of the parts list, 15 digit numbers displayed at the bottom of the parts list...

thanks

0 Likes
Message 4 of 5

bradeneuropeArthur
Mentor
Mentor
Public Sub PLSort()

Dim a As Application
Set a = ThisApplication

Dim b As DrawingDocument
Set b = a.ActiveDocument

Dim c As PartsList
Dim d As PartsListColumn

Set c = b.ActiveSheet.PartsLists.Item(1)

c.Sort "Part Number", True, "ANY", True, "ANY", True
End Sub

Regards,

Autodesk Software: Inventor Professional 2018 | Vault Professional 2018 | Autocad Mechanical 2018
Programming Skills: Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Dimension Component! | Partlist Export! | Derive I-properties! | Vault Prompts Via API! | Vault Handbook/Manual!
Drawing Toggle Sheets! | Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved ! 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 5 of 5

drafting03_AR
Contributor
Contributor

Hi bclark, unfortunately I am still using my original solution, using iLogic:

 

Add "Purchased" into an iProperty for all the purchased parts, add that column to the parts list, sort by that column, then by part number and then reduce the column width of that particular iProperty to 0, so it doesn't actually appear on the PartsList.

 

I was able to use vault to add in the text "Purchased" into the iProperty "CostCenter", in one operation.

 

My code is probably very messy as I cobbled it together (I am not a programmer), but it works for me:

 

'This section will add the Cost Center iProperty to a column, rename the title to CostCenter (so the top row doesn't end up wider)
'And Then reduce that column size To 0 so you don't actually see it but it can still be used for sorting
'start of iLogic code----------------------------------------------------------------------------------
On Error Resume Next
Dim oDoc = ThisDoc.Document
If oDoc.DocumentType = kDrawingDocumentObject Then
	Dim oDrawDoc As DrawingDocument
	oDrawDoc = ThisApplication.ActiveDocument
	Dim oSheet As Sheet
	oSheet = oDrawDoc.ActiveSheet

	For Each oPartList As PartsList In oSheet.PartsLists

		Dim oPropTyp As String
    	oPropType = Inventor.PropertyTypeEnum.kFileProperty

    	Dim CostCol As PartsListColumn
		CostCol = oPartList.PartsListColumns.Add(oPropType,"{32853F0F-3444-11D1-9E93-0060B03C1CA6}","9","4")
		'Change column title and column width to 0
		CostCol.Title = "CostCenter"
		CostCol.Width=0
	Next

	' This rule will sort the BOM in a drawing by Part Number, Renumber and save overrides to model BOM. Note: you have to have the sheet with the parts list in it active
	'start of iLogic code----------------------------------------------------------------------------------
	'sort parts list

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

	oPartsList1.Sort("CostCenter", 1, "PART NUMBER", 1)
	'oPartsList1.Sort("PART NUMBER", 1, "COST CENTER", 1)
	'oPartsList1.Sort("PART NUMBER")
	oPartsList1.Renumber
	oPartsList1.SaveItemOverridesToBOM
	oPartsList1.ShowTitle() = False
	'oPartsList1.MaximumRows() = 40 'use this code if you want to automatically wrap at a certain row number
Else
	MessageBox.Show("File is not a drawing", "Ausroad iLogic")
End If


0 Likes