I think i have a strange one here, I'm bringing a BOM into an assy drawing using the TopLevelOnly setting. My "new" BOM works in the drawing perfecly. In my code I bring in the same BOM template and it does not always work. In the code I know the config name and have verified that the macro has the correct config. But on some top level drawings it is not populating the BOM, I get just the headers.
' This section adds the BOM to the Drawing
'
Dim longstatus As Long, longwarnings As Long
Set swApp = Application.SldWorks
Dim swSelMgr As SldWorks.SelectionMgr
Dim swBomTable As SldWorks.BomTableAnnotation
Dim swView As SldWorks.View
Dim vPickPt As Variant
Dim strConfigName As String
Set swSelMgr = swModel.SelectionManager
Set swView = swSelMgr.GetSelectedObject5(1)
Debug.Print swView.ReferencedConfiguration
strConfigName = swView.ReferencedConfiguration
' Debug.Print strConfigName
MsgBox strConfigName
vPickPt = swSelMgr.GetSelectionPoint(1)
If Matl = "304SS" Then
Set swBomTable = swView.InsertBomTable2( _
False, _
vPickPt(0), vPickPt(1), _
swBOMConfigurationAnchorType_e.swBOMConfigurationAnchor_TopLeft, _
swBomType_e.swBomType_TopLevelOnly, _
strConfigName, "C:\SolidWorks Data\Fontaine\Macro\Outils\Tools\VM-XML-BOM-304.sldbomtbt"): Debug.Assert Not swBomTable Is Nothing
End If
SolidworksApi macros