There are tow sheet in Drawing
Need change Note
Example1 "Draw1" Change "DrawSheet1" in Sheet1
Example2 "Draw1" Change "DrawSheet2" in Sheet2
------------------------------------------------
Sheet1 ---- obtain ID No:DetailItem13 *** Text: Draw1
Sheet2 ---- obtain ID No:DetailItem13 *** Text: Draw1
Obtain ID NO Program
------------------
Option Explicit
Dim SwName As String
Dim SwText As String
Sub main()
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim swDraw As SldWorks.DrawingDoc '工程图对象
Dim swView As SldWorks.View '视图对象
Dim swNote As SldWorks.Note '注释对象
Dim swAnn As SldWorks.Annotation '标注对象
Dim bRet As Boolean
Set swApp = CreateObject("SldWorks.Application")
Set swModel = swApp.ActiveDoc
Set swDraw = swModel
Set swView = swDraw.GetFirstView 'Get First View
Debug.Print swView.Name
Set swNote = swView.GetFirstNote 'Get First Note 得到第一个注释
swModel.ClearSelection2 (True)
Debug.Print "File = " & swModel.GetPathName
Do While Not swNote Is Nothing
Set swAnn = swNote.GetAnnotation 'Get Annotation 得到标注
bRet = swAnn.Select2(True, 0) 'Highlight select 高亮选中
Debug.Assert bRet
SwName = swNote.GetName
SwText = swNote.GetText
Debug.Print " Name:" & swNote.GetName; " *** Text: " & swNote.GetText
Set swNote = swNote.GetNext 'Next Note 下一个注释
Loop
End Sub
-----------------
SolidworksApi macros