IEdmBOMCell.GetTreeLevel Issues

Hello:

I am trying to look at a BOM in PDM and obtain the BOM level for assemblies.  I am hoping to just look it up and have the information returned, however I am suspecting something is dependent on the whole BOM and it needs everything and cannot just calculate a selected item based on a relative path.  I also feel the SolidWorks documentation for this is lacking!

My code looks like this:

Private Function GetAssyLevel(ByVal Assy As String) As Integer
Dim afile As IEdmFile7 = VAULT.GetFileFromPath(System.IO.Path.GetFullPath(SearchFileInVault(Assy)))

' Get a BOM view with the specified layout
BOMMGR = VAULT.CreateUtility(EdmUtility.EdmUtil_BomMgr)

Dim ppoRetLayouts() As EdmBomLayout = Nothing
Dim ppoRetLayout As EdmBomLayout

BOMMGR.GetBomLayouts(ppoRetLayouts)
Dim arrSize As Integer = ppoRetLayouts.Length

ppoRetLayout = ppoRetLayouts(0)

If ppoRetLayout.mbsLayoutName = "BOM" Then
BOMVIEW = afile.GetComputedBOM(ppoRetLayout.mbsLayoutName, 0, "@", EdmBomFlag.EdmBf_AsBuilt + EdmBomFlag.EdmBf_ShowSelected)

End If

' Display BOM view row and column information
Dim ppoRows() As Object = Nothing
Dim ppoRow As IEdmBomCell

BOMVIEW.GetRows(ppoRows)
ppoRow = ppoRows(0)

Return ppoRow.GetTreeLevel

End Function

It returns a Tree Level of 0 for every assembly.  

Thank you!

SolidworksApi/macros