1 Reply Latest reply on Jun 21, 2016 8:00 AM by Yong Ning

    Hide/Show a BOM Colum with API?

    Yong Ning

      Hide column of BOM.jpg

       

       

      Follow code , only hide BOM Table. don't hide column  of BOM Table.

       

       

      Private Sub ll1()

          Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

              Set SwApp = Application.SldWorks

              Set SwModel = SwApp.ActiveDoc

          Dim SwSelMgr As SelectionMgr

              Set SwSelMgr = SwModel.SelectionManager

          Dim SwTabAnn As TableAnnotation

              Set SwTabAnn = SwSelMgr.GetSelectedObject5(1)

          Dim SwAnn As Annotation

              Set SwAnn = SwTabAnn.GetAnnotation

              SwAnn.Visible = swAnnotationVisibilityState_e.swAnnotationHidden

      End Sub

        • Re: Hide/Show a BOM Colum with API?
          Yong Ning

          Private Sub ll2()

             Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

                  Set SwApp = Application.SldWorks

                  Set SwModel = SwApp.ActiveDoc

             Dim SwSelMgr As SelectionMgr

                  Set SwSelMgr = SwModel.SelectionManager

             Dim SwBomTab As BomTableAnnotation, SwBomFeat As BomFeature

                  Set SwBomFeat = SwSelMgr.GetSelectedObject5(1)

                  Set SwBomTab = SwBomFeat.GetTableAnnotations(1)

                 

             Dim SwTabAnn As TableAnnotation

                  Set SwTabAnn = SwBomTab

                 

                  'Debug.Print SwBomTab.BomFeature.GetFeature.Name

                 

                  With SwBomTab

                       Debug.Print .BomFeature.TableType

                      

                  End With

             Dim SwAnn As Annotation

                  With SwTabAnn

                        '.ColumnHidden(1) = True

                        Set SwAnn = .GetAnnotation

                        'SwAnn.Visible = swAnnotationVisibilityState_e.swAnnotationHidden

                        SwAnn.Visible = swAnnotationVisibilityState_e.swAnnotationVisible

                        Stop

                       

                       

                        For jj = .ColumnCount - 1 To .ColumnCount - 2

                             .ColumnHidden(jj) = False

                        Next jj

                  End With

                  With SwAnn

                      ss = .GetPosition

                      '.Visible = False

                     

                  End With

                 

                 

          End Sub