AnsweredAssumed Answered

I want to set the table template style in the parts list.

Question asked by Kato Mai on Jun 28, 2018
Latest reply on Jun 29, 2018 by Kato Mai

Hi, everyone!

I'm not good at English. sorry.

Please teach me your skills.

 

I want to set the table template style in the bill of materials.

For example...

図6.png

However, when outputting with a macro, the style of the table changes.

For example, the line height of the second and subsequent lines will become larger, or the left alignment will be centered.

図7.png

When I manually create a BOM, the BOM is subject to the style of the template.

図9.png

Is there anything wrong with the source?

===================================================================================================

    'Dim swView As SldWorks.View

    'Set swApp = Application.SldWorks

    Set obj = swApp.ActiveDoc

    Dim AnchorType              As Long

    Dim swBOMAnnotation         As SldWorks.BomTableAnnotation

    Dim BomType                 As Long

    Dim Configuration           As String

 

 

    Set swModel = obj

    Set swDrawing = swModel

    Set swModelDocExt = swModel.Extension

    boolstatus = obj.Extension.SelectByID2(strDrawingView4_Isometic, "DRAWINGVIEW", 0, 0, 0, True, 0, Nothing, 0) 'Create3rdAngleViews2使用前提で、View名

    boolstatus = swDrawing.ActivateView(strDrawingView4_Isometic)

    'Dim swView  As SldWorks.View

    Set swView = swDrawing.ActiveDrawingView

    'https://forum.solidworks.com/thread/220083

    ' Insert indented BOM table

    AnchorType = swBOMConfigurationAnchorType_e.swBOMConfigurationAnchor_TopRight '右上を基準とする

    BomType = swBomType_e.swBomType_TopLevelOnly

    Configuration = ""

    Set swBOMAnnotation = swView.InsertBomTable4(False, rSheetWidth - vMarginSheetFrame, rSheetHeight - vMarginSheetFrame, AnchorType, BomType, Empty, strFolderPath_Template + strTemplateName_Table, False, swNumberingType_e.swNumberingType_Detailed, True)

 

 

    ' Insert BOM table

    swModel.ClearSelection2 True

    ' Because BOM type is swBomType_TopLevelOnly,

    ' then work with BomFeature to get and set configurations

    Dim swBomFeat As SldWorks.BomFeature

    Set swBomFeat = swBOMAnnotation.BomFeature

    Dim Names As Variant

    Dim Visible As Variant

    Dim swFeatMgr As SldWorks.FeatureManager

    Names = swBomFeat.GetConfigurations(False, Visible)

    Visible(0) = True

    boolstatus = swBomFeat.SetConfigurations(True, Visible, Names)

 

 

    Set obj = swApp.ActiveDoc

===================================================================================================

thank you for reading.

 

kato.

Outcomes