1 Reply Latest reply on Jul 18, 2015 10:34 PM by Yong Ning

    How to write  note with a stack with API

    Yong Ning

      How to write  note with a stack with API

       

      2+notes.JPG

       


      How to write such a text, using the stack? | SOLIDWORKS Forums

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

       

       

      %D0%9F%D0%BE%D1%81%D0%B0%D0%B4%D0%BA%D0%B0+4.jpg

        • Re: How to write  note with a stack with API
          Yong Ning

          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

                Set SwDraw = SwModel

             Dim SwNote As Note, Str

                Set SwNote = SwSelMgr.GetSelectedObject5(1)

                SwNote.SetName "DwgNote"

                Str = "<FONT size=3>10<STACK size=1 divider=no>-6<OVER></STACK>"

                SwNote.SetText Str

          End Sub

           

           

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

           

          Private Sub ll2()

             Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

                Set SwApp = Application.SldWorks

                Set SwModel = SwApp.ActiveDoc

             Dim SwDraw As DrawingDoc, vSheets, SwSheet As Sheet

               

                Set SwDraw = SwModel

                vSheets = SwDraw.GetSheetNames

            

             Dim SwView As View, SwNote As Note, SwAnn As Annotation

                For ii = 0 To UBound(vSheets)

                   SwDraw.ActivateSheet vSheets(ii)

                   Set SwView = SwDraw.GetFirstView

                   Set SwSheet = SwDraw.GetCurrentSheet

                   'Set SwView = SwView.GetNextView

                   Set SwNote = SwView.GetFirstNote

                   Do While Not SwNote Is Nothing

                      If SwNote.GetName Like "*Arra*" Then

                         Debug.Print SwSheet.GetName, SwNote.GetName

                         Set SwAnn = SwNote.GetAnnotation

                         SwAnn.Select True

                      End If

                      Set SwNote = SwNote.GetNext

                   Loop

                   'Stop

                   SwModel.EditDelete

                Next ii

          End Sub