My goal is to loop through a single layer and modify the text of a Note. I thought that the GetEntities method would enable me to do this, but it isn't working as expected. Below is the relevant part of my code and I was expecting the number of returned objects to be 13 but the method had returned an array containing every note within the entire drawing. Any thoughts on where I am going wrong?
'Build Draftsight interfaces
Set dsModel = dsDoc.GetModel()
Set dsSketchMgr = dsModel.GetSketchManager()
Set dsSelectionMgr = dsDoc.GetSelectionManager()
Set dsSelectionFilter = dsSelectionMgr.GetSelectionFilter()
'Create objects
Dim aNote As DraftSight.Note
Dim entityItem As Variant
Dim entityTypes As Variant
Dim entityObjects As Variant
Dim layerEntity(0) As String
'Add layer name to an array
layerEntity(0) = dsDoc.GetLayerManager.GetLayer(layerName).Name
'Clear selection filter, get only Notes, apply filter
dsSelectionFilter.Clear
dsSelectionFilter.AddEntityType dsObjectType_e.dsNoteType
dsSelectionFilter.Active = True
'Get all entities within specified layer
dsSketchMgr.GetEntities dsSelectionFilter, layerEntity, entityTypes, entityObjects
'Loop through all the note entities in that layer and see if any match the one in the current record
For Each entityItem In entityObjects
Set aNote = entityItem
Debug.Print UBound(entityObjects)
Debug.Print LBound(layerEntity) & ":" & UBound(layerEntity) & vbTab & layerEntity(0)
Debug.Print aNote.Handle & vbTab & aNote.Layer & vbTab & aNote.Text
If aNote.Handle = testHandle Then
handleFound = True
Exit For
End If
Next
