Sub llll3()
Dim SwApp As SldWorks.SldWorks
Set SwApp = Application.SldWorks
Dim SwModel As ModelDoc2, SwDraw As DrawingDoc
Set SwModel = SwApp.ActiveDoc
Set SwDraw = SwModel
''
Dim SwView As View, kk As Integer
Dim SwNote As Note
Set SwView = SwDraw.GetFirstView
''
Do While Not SwView Is Nothing
Debug.Print SwView.GetName2
Set SwNote = SwView.GetFirstNote
Do While Not SwNote Is Nothing
Debug.Print kk, SwNote.GetName & "@" & SwView.Name
kk = kk + 1
Set SwNote = SwNote.GetNext
Loop
Set SwView = SwView.GetNextView
Loop
''
End Sub
Result is
0 DetailItem1@Sheet1
1 DetailItem2@Sheet1
2 DetailItem3@Sheet1
3 DetailItem4@Sheet1
4 DetailItem5@Sheet1
5 DetailItem6@Sheet1
................................
Sub lllfff()
Dim SwApp As SldWorks.SldWorks, SwModel As ModelDoc2, SwDraw As DrawingDoc
Dim SwSelMgr As SelectionMgr, tmp, Str
Set SwApp = Application.SldWorks
Set SwModel = SwApp.ActiveDoc
Set SwDraw = SwModel
Set SwSelMgr = SwModel.SelectionManager()
Str = "DetailItem16@Sheet1" → don't Select Note
tmp = SwModel.Extension.SelectByID2(Str, "NOTE", 0, 0, 0, False, -1, Nothing, 0)
Debug.Print tmp→ result is False
'recodr Macro result is
Str = "DetailItem50@Sheet Format1"
tmp = SwDraw.Extension.SelectByID2(Str, "NOTE", 0, 0, 0, False, 0, Nothing, 0)
Debug.Print tmp → Result is True
End Sub
***************************************************************************************************
Help me,Traverse view in Sheet Format1→
Do While Not SwNote Is Nothing
Debug.Print kk, SwNote.GetName & "@" & SwView.Name
kk = kk + 1
Set SwNote = SwNote.GetNext
Loop
How to SwView.Name → Str = "DetailItem50@Sheet1" (View name is Sheet1)
→ Str = "DetailItem50@Sheet Format1" (Viewname is Sheet Format1)
Thanks.
SolidworksApi macros