0 Replies Latest reply on May 7, 2015 10:23 AM by Yong Ning

    How to  select face for insert the balloon?

    Yong Ning

      How to get selected face . eg;inserting the balloon in selected face.

      for code is

       

      Private Sub ll()

         Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

            Set SwApp = Application.SldWorks

            Set SwModel = SwApp.ActiveDoc

         Dim tmp

            tmp = SwModel.Extension.SelectByID2("", "FACE", 0.03803370739932, 0.1579172520431, 0, False, 0, Nothing, 0)

         Dim SwNote As INote

            Set SwNote = SwModel.InsertStackedBalloon(1, 1, 1, "", 0, "")

         

         Dim SwStack As IBalloonStack

            Set SwStack = SwNote.GetBalloonStack

            tmp = SwModel.Extension.SelectByID2("", "FACE", 0.03780753533376, 0.1757848452221, 0, False, 0, Nothing, 0)

            Set SwNote = SwStack.AddTo(1, "2", 0, "")

            Stop

      End Sub

       

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

       

      question:

        .SelectByID2("", "FACE", 0.03780753533376, 0.1757848452221, 0, False, 0, Nothing, 0)

      x,y coordinate is manual select face.

      Help ,use code select face. see fig.

      5.jpg

       

      ''

      Private Sub ll2()

         Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

            Set SwApp = Application.SldWorks

            SwApp.SetUserPreferenceToggle swSketchInference, True

            Set SwModel = SwApp.ActiveDoc

         Dim SwSelMgr As SelectionMgr

            Set SwSelMgr = SwModel.SelectionManager

         Dim SwView As View

            Set SwView = SwSelMgr.GetSelectedObject5(1)

         Dim Ss

            Ss = SwView.Position

            Stop

           

         Dim tmp

            tmp = SwModel.Extension.SelectByID2("", "SILHOUETTE", Ss(0) + 0.05, Ss(1) - 0.021, 0, False, 0, Nothing, 0)

            'tmp = SwModel.Extension.SelectByID2("", "FACE", Ss(0) + 0.5, Ss(1) - 0.21, 0, False, 0, Nothing, 0)

            Stop

            Stop

         Dim SwNote As INote

            Set SwNote = SwModel.InsertStackedBalloon(1, 1, 1, "", 0, "")

            Stop

         Dim SwStack As IBalloonStack

            Set SwStack = SwNote.GetBalloonStack

            tmp = SwModel.Extension.SelectByID2("", "FACE", 0.03780753533376, 0.1757848452221, 0, False, 0, Nothing, 0)

            Set SwNote = SwStack.AddTo(1, "2", 0, "")

            Stop

      End Sub

       

       

       

       

      Private Sub ll3()

         Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

            Set SwApp = Application.SldWorks

            SwApp.SetUserPreferenceToggle swSketchInference, True

            Set SwModel = SwApp.ActiveDoc

         Dim SwSelMgr As SelectionMgr

            Set SwSelMgr = SwModel.SelectionManager

         Dim SwView As View

            Set SwView = SwSelMgr.GetSelectedObject5(1)

         Dim Ss

            Ss = SwView.Position

           

           Stop

         Dim tmp

            tmp = SwModel.Extension.SelectByID2("", "FACE", Ss(0) - 0.5, Ss(1) - 0.23, 0, False, 0, Nothing, 0)

            Stop

         Dim SwNote As INote

            Set SwNote = SwModel.InsertStackedBalloon(1, 1, 1, "", 0, "")

            Stop

         Dim SwStack As IBalloonStack

            Set SwStack = SwNote.GetBalloonStack

            tmp = SwModel.Extension.SelectByID2("", "FACE", 0.03780753533376, 0.1757848452221, 0, False, 0, Nothing, 0)

            Set SwNote = SwStack.AddTo(1, "2", 0, "")

            Stop

      End Sub

      ''

       

       

      ''

      Private Sub ll4()

         Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

            Set SwApp = Application.SldWorks

            SwApp.SetUserPreferenceToggle swSketchInference, True

            Set SwModel = SwApp.ActiveDoc

         Dim SwSelMgr As SelectionMgr

            Set SwSelMgr = SwModel.SelectionManager

         Dim SwView As View

            Set SwView = SwSelMgr.GetSelectedObject5(1)

         Dim Ss

            Ss = SwView.Position

            Stop     

         Dim tmp

            tmp = SwModel.Extension.SelectByID2("", "SILHOUETTE", Ss(0) - 0.08 / 1000, Ss(1) - 252.78 / 2000, 0, False, 0, Nothing, 0)

            'tmp = SwModel.Extension.SelectByID2("", "FACE", Ss(0) + 0.5, Ss(1) - 0.21, 0, False, 0, Nothing, 0)

            Stop

            Stop

         Dim SwNote As INote

            Set SwNote = SwModel.InsertStackedBalloon(1, 1, 1, "", 0, "")

            Stop

         Dim SwStack As IBalloonStack

            Set SwStack = SwNote.GetBalloonStack

            tmp = SwModel.Extension.SelectByID2("", "FACE", 0.03780753533376, 0.1757848452221, 0, False, 0, Nothing, 0)

            Set SwNote = SwStack.AddTo(1, "2", 0, "")

            Stop

      End Sub