0 Replies Latest reply on Apr 12, 2014 6:48 PM by Jeroen Janssen Andeweg

    How to delete BomTable in assembly

    Jeroen Janssen Andeweg

      Hi all,

       

      I am able to insert a BOM in an assembly using InsertBomTable3. I took parts out of this code:

       

      ' ----------------------------------------------

      Imports SolidWorks.Interop.sldworks
      Imports SolidWorks.Interop.swconst
      Imports System.Runtime.InteropServices
      Imports System
      Imports System.Diagnostics


      Public Class frm_START
          Dim swApp As SldWorks
          Dim swModel As ModelDoc2
          Dim swModelDocExt As ModelDocExtension
          Dim swBOMAnnotation As BomTableAnnotation
          Dim swBOMFeature As BomFeature
          Dim BomType As Integer
          Dim nbrType As Integer
          Dim Configuration As String
          Dim TemplateName As String
          Dim nErrors As Integer
          Dim nWarnings As Integer

          Sub Main()

              ' Open assembly document
              swModel = swApp.OpenDoc6("C:\Program Files\SolidWorks Corp\SolidWorks\samples\tutorial\api\arm2.sldasm", swDocumentTypes_e.swDocASSEMBLY, swOpenDocOptions_e.swOpenDocOptions_Silent, "", nErrors, nWarnings)
              swModelDocExt = swModel.Extension


              ' Insert BOM table
              TemplateName = "C:\Program Files\SolidWorks Corp\SolidWorks\lang\english\bom-standard.sldbomtbt"
              BomType = swBomType_e.swBomType_Indented
              Configuration = "Default"
              nbrType = swNumberingType_e.swNumberingType_Detailed

              swBOMAnnotation = swModelDocExt.InsertBomTable3(TemplateName, 0, 0, BomType, Configuration, True, nbrType, True)
              swBOMFeature = swBOMAnnotation.BomFeature

          End Sub

      End Class

      ' ------------------------------

       

       

      Note that the inserted BOM is hidden.

      My app is doing its routine and the BOM is still hidden. All good sofar.

      Saving the assembly and guess what, the BOM appears in the 'Tables' and that is not what I would like to see.

      I have looked in features, extension, assemblydoc, modeldoc2 but I am not able to find anything related to deleteting that BOM.

      How do I avoid the bom to appear in the 'Tables'?

       

      Your time in this is much appreciated