Get part list columns property

Get part list columns property

ChristianAndersenIsmyname
Advocate Advocate
341 Views
2 Replies
Message 1 of 3

Get part list columns property

ChristianAndersenIsmyname
Advocate
Advocate

Hi,

 

I can't seem to figure out how to get the part list column property if that property isn't BOM related (if I understand it correctly).

Below I've figured out how to get the Item column instead of relying on header text, but for part numbers I can't find that property (kPart... something I guess).

For my item column, it can be renamed to whatever it want and it will still always be found if it exists, but thats not possible with Part number column. If someone rename that it won't find the column.

 

 

For i As Integer = 1 To myBOM.PartsListColumns.Count
   MsgBox(myBOM.PartsListColumns(i).Title & vbLf & vbLf & myBOM.PartsListColumns(i).PropertyType.ToString)

   If myBOM.PartsListColumns(i).PropertyType = PropertyTypeEnum.kItemPartsListProperty Then
      ItemColumn = i
      itemexist = True
      MsgBox("Item column: " & i)
   End If

   If myBOM.PartsListColumns(i).Title = "PART NUMBER" Then
      PartColumn = i
      partexist = True
      MsgBox("Part column: " & i)
   End If
Next

 

 

The first message box will show "ITEM and kItemPartListProperty" when i = item index

When i = part list index, it will show "PART LIST and kFileProperty" (a property I can't use).

 

Anyone know how I can get that part number property?

I assume Stock number and description will be in the same alley as part number?

 

Thanks!

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

Ralf_Krieg
Advisor
Advisor
Accepted solution

Hello

 

Use the GetFilePropertyID method

Dim oDraWDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet=oDraWDoc.ActiveSheet
'we assume there's only one partslist on the active sheet
Dim oPL As PartsList = oSheet.PartsLists(1)

Dim sPropSetID As String
Dim sPropID As String
For i As Integer = 1 To oPL.PartsListColumns.Count
	If oPL.PartsListColumns(i).PropertyType = PropertyTypeEnum.kFileProperty Then
		oPL.PartsListColumns(i).GetFilePropertyId(sPropSetID, sPropID)	
		If sPropSetID = "{32853F0F-3444-11D1-9E93-0060B03C1CA6}" And sPropID = "5" Then
			MsgBox("Partnumber column is column number " & i)
		End If
	End If
Next

R. Krieg
RKW Solutions
www.rkw-solutions.com
0 Likes
Message 3 of 3

ChristianAndersenIsmyname
Advocate
Advocate

Thank you!

Worked perfectly with a little help from this cheat sheet 🙂

0 Likes