Good morning @harvey_craig2RCUH. Glad to see that you got it figured out. Now that I am back at my work computer, and have access to my notes & snippets, I see that the AttributeSet and Attributes used in this situation are actually named exactly the same as those used by the iLogic 'NamedEntities' system, on the part / model side. The name of the AttributeSet is "iLogicEntityNameSet", and the name of the Attribute is "iLogicEntityName". It can be tempting to use a Try...Catch...End Try block of code, or check Count, around where we access those Attributes, to avoid the potential error of no attributes present, and keep the code a bit shorter, but the attributes already have a system in place for that sort of thing, when you already know the names of the ones you are looking for (AttributeSets.NameIsUsed & AttributeSet.NameIsUsed), so I usually use that system instead. Since I already had multiple iLogic snippets saved for finding &/or deleting dimensions by their names, I will post a code example below that is a combination of your code process, and one of the ones I had on hand. You may find this helpful, or at least interesting, due to how it gets and records the data, then sorts that data, then writes a report out about that data. However, the way it is right now, if a dimension is encountered which does not have an attribute based name, it is skipped (Line 19)...not sure if that is desired or not though.
Sub Main
Dim oDDoc As DrawingDocument = TryCast(ThisDoc.Document, Inventor.DrawingDocument)
If oDDoc Is Nothing Then Return
'define the variable and its Type, for recording the data
'a Dictionary is like a List, but with each entry having two factors
'Key and Value - Key is used to identify each item
Dim oDimsData As New Dictionary(Of String, Inventor.Point2d)
'the names of the AttributeSet & Attribute objects we are looking for
Dim sSetName As String = "iLogicEntityNameSet"
Dim sAttName As String = "iLogicEntityName"
'now start iterating through the dimensions on the active sheet
For Each oDDim As DrawingDimension In oDDoc.ActiveSheet.DrawingDimensions
Dim sName As String = ""
If oDDim.AttributeSets.NameIsUsed(sSetName) AndAlso
oDDim.AttributeSets.Item(sSetName).NameIsUsed(sAttName) Then
sName = oDDim.AttributeSets.Item(sSetName).Item(sAttName).Value
End If
If sName = "" Then
Continue For 'not a 'named' dimension, so skip recording it
Else
'record name and location as an entry into the Dictionary
oDimsData.Add(sName, oDDim.Text.Origin)
End If
Next
'sort the data entries by the names of the dimensions now
Dim oSortedData As IOrderedEnumerable(Of KeyValuePair(Of String, Inventor.Point2d)) = oDimsData.OrderBy(Function(d) d.Key)
'now write this data into the iLogic Log window (only works if that tab is visible)
For i As Integer = 0 To oSortedData.Count() -1
Dim oPt As Inventor.Point2d = oSortedData.ElementAt(i).Value
Logger.Info(vbCrLf & _
"Name = " & oSortedData.ElementAt(i).Key & vbCrLf & _
"Location = " & oPt.X.ToString & " x " & oPt.Y.ToString & vbCrLf)
Next
'now click on the iLogic Log tab to look within that window and view the results
End Sub
Wesley Crihfield

(Not an Autodesk Employee)