I am trying to insert a BOM into an assembly. This inserts the BOM but the BOM only shows the column titles it does not have the columns in it. I also can not get the configuration names that are available to the BOM. Does anyone have an idea of what I’m doing wrong?
Thanks
Dan Miel
Dim swApp As SldWorks.SldWorks
Dim Part As SldWorks.ModelDoc2
Dim BOMPath As String
Dim BomFeat As SldWorks.BomFeature
Dim BTann As SldWorks.BomTableAnnotation
Dim Conf As String
Dim ConfNames As Variant
Sub main()
Set swApp = Application.SldWorks
Set Part = swApp.ActiveDoc
BOMPath = "C:\\Program Files\\SW Support Files\\Templates\\BOM-QTY.sldbomtbt"
Conf = swApp.GetActiveConfigurationName(Part.GetPathName)
Set BTann = Part.Extension.InsertBomTable(BOMPath, 0, 0, swBomType_TopLevelOnly, Conf)
Set BomFeat = BTann.BomFeature
Debug.Print "Num of Configs = " & BomFeat.GetConfigurationCount(False)
'ConfNames = BomFeat.GetConfigurations(False, Visible)
'Debug.Print UBound(ConfNames)
Part.FeatureManager.UpdateFeatureTree
End Sub
