0 Replies Latest reply on Jan 22, 2016 7:35 PM by Yong Ning

    TablePatternFeatureData→Why don't  SavePointsToFile?

    Yong Ning

      SavePt.jpg

      Why can read GetBasepoint and PointArray

       

      Why don't SavePointsToFile?

       

      *************************************************

            tmp = .AccessSelections(SwModel, Nothing)

            Debug.Print tmp → result is True

      ??????

            tmp = .SavePointsToFile("D:\a.SldPTab")

            Debug.Print tmp →  Result is False

       

      **************************************************

      Sub a1()

       

          Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

             Set SwApp = Application.SldWorks

             Set SwModel = SwApp.ActiveDoc

          Dim SwSelMgr As SelectionMgr, SwFeat As Feature

             Set SwFeat = SwModel.FeatureByName("AAA")

             Debug.Print SwFeat.Name

             Set SwSelMgr = SwModel.SelectionManager

          Dim SwTableFeatData As TablePatternFeatureData

             Set SwTableFeatData = SwFeat.GetDefinition

          Dim vBasePt, vPt

       

          With SwTableFeatData

            tmp = .AccessSelections(SwModel, Nothing)

            Debug.Print tmp

            Stop

            vBasePt = .GetBasePoint

            vPt = .PointArray

            tmp = .SavePointsToFile("D:\a.SldPTab")

            Debug.Print tmp

            Stop

            .ReleaseSelectionAccess

          End With

       

       

      End Sub

       

       

       

       

      Sub a1()

       

          Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

             Set SwApp = Application.SldWorks

             Set SwModel = SwApp.ActiveDoc

          Dim SwSelMgr As SelectionMgr, SwFeat As Feature

             Set SwFeat = SwModel.FeatureByName("TPattern1")

             Debug.Print SwFeat.Name

             Set SwSelMgr = SwModel.SelectionManager

          Dim SwTableFeatData As TablePatternFeatureData

             Set SwTableFeatData = SwFeat.GetDefinition

          Dim vBasePt, vPt, vPt1, Pt() As Double, bPt(2) As Double

             vPt = Array(-0.032, -0.06, 0, -0.064, 0, 0, 0, 0.064, 0)

          With SwTableFeatData

            tmp = .AccessSelections(SwModel, Nothing)

            'Debug.Print tmp

            vBasePt = .GetBasePoint

            vPt1 = .PointArray

           

            ReDim Pt(UBound(vPt) + UBound(vPt1) + 1) As Double

           

            For ii = 0 To UBound(vPt1)

               Pt(ii) = vPt1(ii)

            Next ii

            For ii = 0 To UBound(vPt)

               Pt(ii + UBound(vPt1) + 1) = vPt(ii)

            Next ii

           

             .PointArray = Pt

            .ReleaseSelectionAccess

          End With

          SwFeat.ModifyDefinition SwTableFeatData, SwModel, Nothing

          Stop

       

      End Sub