2 Replies Latest reply on Jun 29, 2018 12:19 AM by Kato Mai

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

    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.

        • Re: I want to set the table template style in the parts list.
          Fifi Riri

          The format of the table is stored in the Table Template.

          Modify the format of the table > Right clic your table > save as > save the .sldbomtbl file with your other templates > update "strTemplateName_Table" with the name of the .sldbomtbl file

            • Re: I want to set the table template style in the parts list.
              Kato Mai

              Fifi!

               

              Thank you for your reply.

              I solved myself a while before getting a reply from you.

              I customized the table template.

               

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

                  Configuration = "Default"

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

               

              ※Delete the following sources

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

              I am deeply grateful for the reply.