4 Replies Latest reply on Apr 30, 2018 2:32 PM by Michael Spens

    Hole Table Update Very Slow...

    Dave Paul

      I have a macro that adds three rows of calculated data to a hole table.  I'm using an Excel worksheet function for some of the calculations.  When I add the data to the hole table with a loop, it is a long process.

      I have other macros that add data to BOM tables that are very fast.  Where is my issue??  Thank you for your help.

       

      UPDATE: Adding the command "swHoleTable.EnableUpdate = False" doesn't help.

       

      Dim swHoleTable As SldWorks.HoleTable
          Dim swTableAnn As SldWorks.TableAnnotation
          Dim swHoleTableAnn As SldWorks.HoleTableAnnotation
          Dim swAnn As SldWorks.Annotation
      
          boolstatus = swModel.Extension.SelectByID2("Hole Table1", "HOLETABLE", 0, 0, 0, False, 0, Nothing, 0)
          Set swHoleTable = swSelMgr.GetSelectedObject6(1, -1)
          Set swHoleTableAnn = swHoleTable.GetTableAnnotations(0)
          Set swTableAnn = swHoleTableAnn
          If swTableAnn.ColumnCount < 7 Then
            Call swTableAnn.SetColumnTitle(4, "DD")
            Call swTableAnn.InsertColumn2(swTableItemInsertPosition_Last, 0, "DMS", swInsertColumn_DefaultWidth)
            Call swTableAnn.InsertColumn2(swTableItemInsertPosition_Last, 0, "BC", swInsertColumn_DefaultWidth)
          End If
      
           ' Calculations happen here...
           ' Slow text insertion loop
          For I = 0 To UBound(dblTableData)
            swTableAnn.Text(I + 1, 4) = CStr(dblTableData(I, 2))
            swTableAnn.Text(I + 1, 5) = CStr(dblTableData(I, 3))
            swTableAnn.Text(I + 1, 6) = CStr(dblTableData(I, 4))
          Next I