0 Replies Latest reply on Jan 29, 2015 3:10 AM by Yong Ning

    Why don't run InsertHoleTable

    Yong Ning

      InsertTable1.jpg

       

       

       

       

      2010 SolidWorks API Help - Insert Hole Table Example (VBA)

      http://help.solidworks.com/2010/english/api/sldworksapi/insert_hole_table_example_vb.htm

       

       

      Set swApp = Application.SldWorks

          Set swModel = swApp.ActiveDoc

          Set swSelMgr = swModel.SelectionManager

          Set swView = swSelMgr.GetSelectedObject5(1)

          vPickPt = swSelMgr.GetSelectionPoint(1)

          Set swHoleTable = swView.InsertHoleTable( _

                              False, _

                              vPickPt(0), vPickPt(1), _

                              swBOMConfigurationAnchor_TopLeft, _

                              ""): Debug.Assert Not swHoleTable Is Nothing

          Set swTable = swHoleTable

       

       

       

       

       

      2010 SolidWorks API Help - Change Tags in Hole Table Example (VBA)

      http://help.solidworks.com/2010/english/api/sldworksapi/change_tags_in_hole_table_example_vb.htm

       

       

       

      2010 SolidWorks API Help - Document Properties > Tables > Hole

      http://help.solidworks.com/2010/english/api/swconst/dp_tables-hole.htm

      DP_Tables-Hole.gif

       

       

       

      How to use Hole table with API? | SOLIDWORKS Forums

      https://forum.solidworks.com/thread/64491

       

       

      How get ID of line in drawing? | SOLIDWORKS Forums

      https://forum.solidworks.com/thread/52695

       

       

      How to use InsertCenterMark2? | SOLIDWORKS Forums

      https://forum.solidworks.com/message/363829#363829

       

       

       

       

       

       

       

       

      Private Sub ll()

         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 SwDraw As DrawingDoc, SwView As View

            Set SwDraw = SwModel

         Dim SwFeat As Feature, Ss, Pp(1), Rr

            Set SwFeat = SwDraw.FeatureByName("Drawing View10")

            SwFeat.Select True

            Set SwView = SwFeat.GetSpecificFeature2

            Debug.Print SwView.ScaleDecimal

            kk = SwView.ScaleRatio

          

            Ss = SwView.Position

            Rr = 300 / 2 / 1000

            Pp(0) = Ss(0) + Rr * SwView.ScaleDecimal

            Pp(1) = Ss(1)

            ''

            With SwModel.Extension

               .SelectByID2 "", "EDGE", Pp(0), Pp(1), 0, True, 0, Nothing, 0

               .SelectByID2 "", "FACE", Pp(0) + 10 * SwView.ScaleDecimal, Pp(1), 0, True, 1, Nothing, 0

            End With

            ''

            SwView.InsertHoleTable False, 0.1, 0.1, 3, "D:\h.SldHolTbt"

            Stop

      End Sub