4 Replies Latest reply on May 16, 2018 12:46 AM by Nilesh Patel

    Why does not this setting work? InsertBomTable4:swBomType_TopLevelOnly

    Kato Mai

      Hi, everyone!

      I will post for the first time.

      I'm not good at English. sorry.

      Please teach me your skills.

       

      InsertBomTable4:swBomType

      swBomType_Indented:⇒OK

      swBomType_PartsOnly:⇒OK

      swBomType_TopLevelOnly:⇒NG!!! It does not display well

       

      swBomType_TopLevelOnly_Table.png

      code1.png

        • Re: Why does not this setting work? InsertBomTable4:swBomType_TopLevelOnly
          Kato Mai

          I do not know how to operate this site.

          Why is this question answered (☑)?

          • Re: Why does not this setting work? InsertBomTable4:swBomType_TopLevelOnly
            Nilesh Patel

            Hi Kato,

             

            If you read the remarks for IView::InsertBomTable4  method, you don't specify the configuration, instead use IBomFeature::SetConfigurations method to work with the configuration.

             

            Below is a code snippet for the macro I use to create BOM table for the active configuration in the drawing view:

             

            'Inserts the BOM table at 0,-25 location on drawing origin.
                Set swBOMTableAnn = swView.InsertBomTable4(False, 0, -0.025, swBOMConfigurationAnchorType_e.swBOMConfigurationAnchor_TopLeft, swBomType_e.swBomType_TopLevelOnly, Empty, _
                                                           sBOMTempPath, False, swNumberingType_e.swNumberingType_None, False)
                'Warning message if failes to insert the BOM table.
                If swBOMTableAnn Is Nothing Then
                    swApp.SendMsgToUser2 "Error: Failed to insert the BOM table for the selected view '" & swView.Name & "'.", swMessageBoxIcon_e.swMbStop, swMessageBoxBtn_e.swMbOk
                    Exit Sub
                Else
                    'Gets the BOM feature data and Table annotation objects.
                    'BOM feature data is used to set the referenced configuration in the view.
                    Set swBOMFeat = swBOMTableAnn.BomFeature
                    Set swTableAnn = swBOMTableAnn
                End If
            
            
                'Gets the name of the referenced configuration in the selected drawing view.
                sConfigNames(0) = swView.ReferencedConfiguration
                bVisible(0) = True
                
                'Sets the BOM table configuration to referenced configuration in the selected drawing view.
                'Warning message if failed.
                If False = swBOMFeat.SetConfigurations(True, bVisible, sConfigNames) Then
                    swApp.SendMsgToUser2 "Error: Failed to set BOM configuration to '" & swView.ReferencedConfiguration & "'.", swMessageBoxIcon_e.swMbStop, swMessageBoxBtn_e.swMbOk
                    Exit Sub
                End If
            

             

            Hope it helps.

             

            Regards,

            Nilesh