ScaleRatio

Private Sub ll3()

   Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

      Set SwApp = Application.SldWorks

      Set SwModel = SwApp.ActiveDoc

   Dim SwDraw As DrawingDoc

      Set SwDraw = SwModel

   Dim vSheet, SwNote As INote, SwAnn As Annotation

      vSheet = SwDraw.GetSheetNames

   Dim SwView As View, Ss, Ss1, Str

      For ii = 0 To UBound(vSheet)

         With SwDraw

            .ActivateSheet (vSheet(ii))

            Set SwView = SwDraw.GetFirstView

            Set SwView = SwView.GetNextView

            Do While Not SwView Is Nothing

               SwDraw.ActivateView SwView.GetName2

         

               Ss = SwView.GetOutline

       

               Set SwNote = SwDraw.InsertNote("")

               SwNote.SetName "n" & SwView.GetName2

       

               Ss1 = SwView.ScaleRatio

               Str = "比例:" & Ss1(0) & ":" & Ss1(1)

               Str = "比例:\$PRP:" & """SW-View Scale"""

               'Stop

               SwNote.SetText Str

               Set SwAnn = SwNote.GetAnnotation

               ''

               With SwAnn

                  .SetPosition Ss(0), Ss(1), 0

               End With

       

               Set SwView = SwView.GetNextView

       

            Loop

    

         End With

      Next ii

End Sub

''

''

Private Sub ll5()

   Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2

      Set SwApp = Application.SldWorks

      Set SwModel = SwApp.ActiveDoc

   Dim SwDraw As DrawingDoc

      Set SwDraw = SwModel

   Dim vSheet, SwNote As INote, SwAnn As Annotation

      vSheet = SwDraw.GetSheetNames

   Dim SwView As View, Ss, Ss1, Str

   Dim SwTextFormat As TextFormat

      For ii = 0 To UBound(vSheet)

         With SwDraw

            SwDraw.ActivateSheet (vSheet(ii))

            Set SwView = SwDraw.GetFirstView

            Set SwView = SwView.GetNextView

            Do While Not SwView Is Nothing

               Set SwNote = SwView.GetFirstNote

               ''

               ScaleJustificationCenter SwView, SwNote

               Set SwView = SwView.GetNextView

         

            Loop

      

         End With

      Next ii

End Sub

''

Function ScaleJustificationCenter(SwView As View, SwNote As INote)

   Dim SwAnn As Annotation, Ss, Ss1, Str, Xx, Yy

       ''

       Ss = SwView.ScaleRatio

       'Str = "比 例" & Chr(10) & "————" & Chr(10) & Ss(0) & ":" & Ss(1)

       Str = "比例\$PRP:" & """SW-View Scale"""

       Str = Ss(0) & ":" & Ss(1)

        Str = "比例" & Str & ""

        Debug.Print Str

     

   

       Ss = SwView.GetOutline

       Xx = Ss(0) + (Ss(2) - Ss(0)) / 2

       Yy = Ss(1) - 10 / 1000 '/ SwView.ScaleDecimal

       Set SwAnn = SwNote.GetAnnotation

       SwAnn.SetPosition Xx, Yy, 0

   

   

       SwNote.SetTextJustification swTextJustificationCenter

       SwNote.SetText Str

End Function

SolidworksApi macros