API select all dimensions (annotations) inside a SketchBlock

Hi API guru's :-)

I'm looking for a way to select all dimensions inside a SketchBlock and apply a layer to the dimensions. The macro allready creates the layers.

Such macro will make it possible for the user to show/hide SketchBlock dimensions in an easy and fast way....

But I guess my skills are missing something - I can't figure out how to select all dimensions/annotations.

Below my (*.swp) code this far....

' ******************************************************************************
' Select all dimensions inside a FM tree selected SketchBlock, and apply a layer to the dimensions
' ******************************************************************************
Dim swApp As SldWorks.SldWorks

Dim swModel As SldWorks.ModelDoc2
Dim swSelMgr As SldWorks.SelectionMgr
Dim boolstatus As Boolean
Dim longstatus As Long, longwarnings As Long
Dim mySelType As Long
Dim swDim As SldWorks.Dimension

Dim i As Long

Dim Layername(2) As String
Dim LayerDesc(2) As String
Dim LayerColor(2) As Long
Dim LayerStyle(2) As Integer
Dim LayerWidth As Integer
Dim BOn As Boolean
Dim value As Boolean

Dim swLayerMgr As SldWorks.LayerMgr
Dim swLayer As SldWorks.Layer

'Dim swAnn    As SldWorks.Annotation
'Dim swDispDim As SldWorks.DisplayDimension

Dim swBlockInst As SldWorks.SketchBlockInstance
Dim swBlockDef As SldWorks.SketchBlockDefinition


Sub MakeLayers()

Layername(0) = "MyCenterlines"
LayerDesc(0) = "Centerlines and Centermarks"
LayerColor(0) = RGB(128, 128, 128)
LayerStyle(0) = swLineCENTER

Layername(1) = "MyDimensions"
LayerDesc(1) = "All Dimensions"
LayerColor(1) = RGB(128, 128, 128)
LayerStyle(1) = swLineCONTINUOUS

LayerWidth = 0.18
BOn = True

For i = 0 To 1
value = swModel.CreateLayer(Layername(i), LayerDesc(i), LayerColor(i), LayerStyle(i), LayerWidth, BOn)
Next i
End Sub

Sub main()

Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set swSelMgr = swModel.SelectionManager

MakeLayers 'call sub

mySelType = swSelMgr.GetSelectedObjectType3(1, -1)

Select Case mySelType
Case swSelSUBSKETCHDEF  ' swSelSUBSKETCHDEF=154 - a Block is selected in FM tree
    swModel.SketchManager.EditSketchBlock
               
                swAnn.Layer = Layername(1)

swModel.SketchManager.EndEditSketchBlock True

Case Else
    Exit Sub
End Select

End Sub

SolidworksApi macros