I'm looking for the api to get the excel bom properties like "show parts only", "show top level subassemblies and part only" or "show assemblies and parts in an indented list"?
Thanks a lot
You can control this via user preferences. Check the Remarks section here: 2017 SOLIDWORKS API Help - InsertBomTable Method (IView)
Thank you Artem, that's what I found as well, but I have an existing Excel BOM on a drawing and would like to change it to the "standard" SWX BOM by macro. Therefore I need to get the properties.
Do you mean by replacing existing Excel BOM table with Solidworks BOM using SolidWorks BOM template?
Yes, I would like to change the existing Excel BOM into SolidWorks BOM. Therefore the options from the Excel BOM should be the same for the SolidWorks BOM. My problem is to get the options/properties from the Excel BOM by API...
I don't think you can change Excel BOM into SW BOM. You will have to delete Excel BOM and re-insert SW BOM. Then as Simon Turner mentioned get IBomFeature object of the inserted BOM and change the configuration option.
here I got an example from the API user preferences.the following 3 photos figured out the result. I don't know if this is what you want.
i paste the vba scripts for you here！
Sub TraverseComponent(swComp As SldWorks.Component2, nLevel As Long)
Dim vChildComp As Variant
Dim swChildComp As SldWorks.Component2
Dim swCompConfig As SldWorks.Configuration
Dim sPadStr As String
Dim i As Long
For i = 0 To nLevel - 1
sPadStr = sPadStr + " "
vChildComp = swComp.GetChildren
For i = 0 To UBound(vChildComp)
Set swChildComp = vChildComp(i)
TraverseComponent swChildComp, nLevel + 1
If LCase(Right(swChildComp.GetPathName, 6)) = "sldprt" Then 'Dont export assembly nodes
Debug.Print sPadStr & swChildComp.Name2
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.modelDoc2
Dim swAssy As SldWorks.assemblyDoc
Dim swConf As SldWorks.Configuration
Dim swRootComp As SldWorks.Component2
Dim bRet As Boolean
Dim fileName As String
Dim errors As Long
Dim warnings As Long
Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
Set swConf = swModel.GetActiveConfiguration
Set swRootComp = swConf.GetRootComponent3(True)
TraverseComponent swRootComp, 1
Thank you Gang, great answer but not really what I'm looking for. Please find my response to Artem
Could somebody help me to find the api?
It's found in IBomFeature.TableType
You get the IBomFeature interface from IFeature::GetSpecificFeature2
Retrieving data ...