Here's a small VBA program that does what you want. I added some additional checks that aren't actually needed for the example you provided but will handle cases where the cylinder that has the knurling has some additional cuts and isn't a clean cylinder.
Public Sub GetKnurledInfo()
' Get the active part document.
Dim partDoc As PartDocument
Set partDoc = ThisApplication.ActiveDocument
' Query the attributes to see if there is a FaceColor
' attribute with the value "Metal-Steel (Knurled)"
Dim attribSets As AttributeSetsEnumerator
Set attribSets = partDoc.AttributeManager.FindAttributeSets( _
"com.autodesk.inventor.FaceAttributes", _
"FaceColor", "Metal-Steel (Knurled)")
' Check to make sure any attribute sets were found.
If attribSets.count = 0 Then
MsgBox "The part does not contain any knurled faces."
Exit Sub
End If
' Iterate through the found attribute sets.
Dim i As Integer
For i = 1 To attribSets.count
' Get the face from the current attribute set.
Dim knurledFace As face
Set knurledFace = attribSets.Item(i).Parent.Parent
' Make sure the face is a cylinder.
If knurledFace.SurfaceType = kCylinderSurface Then
' Get the diameter from the cylinder.
Dim cyl As Cylinder
Set cyl = knurledFace.Geometry
Dim diameter As Double
diameter = cyl.Radius * 2
' Get the extent of the knurl by getting the circular edges
' at each end of the cylinder and using their centers as
' the extents.
Dim extent1 As Point
Dim extent2 As Point
Dim checkLoop As EdgeLoop
For Each checkLoop In knurledFace.EdgeLoops
If checkLoop.IsOuterEdgeLoop Then
' Find a circle or arc on the edge.
Dim checkEdge As Edge
For Each checkEdge In checkLoop.Edges
If checkEdge.GeometryType = kCircleCurve Then
Dim checkCircle As Inventor.Circle
Set checkCircle = checkEdge.Geometry
If extent1 Is Nothing Then
Set extent1 = checkCircle.center
Else
Set extent2 = checkCircle.center
End If
ElseIf checkEdge.GeometryType = kCircularArcCurve Then
Dim checkArc As Inventor.Arc3d
Set checkArc = checkEdge.Geometry
If extent1 Is Nothing Then
Set extent1 = checkArc.center
Else
Set extent2 = checkArc.center
End If
End If
Next
End If
Next
Dim uom As UnitsOfMeasure
Set uom = partDoc.UnitsOfMeasure
Dim result As String
result = "Knurled Face:" & vbCrLf & " Diameter: " & _
uom.GetStringFromValue(diameter, kDefaultDisplayLengthUnits) & _
vbCrLf & " Point 1: " & ShowPoint(extent1, uom) & vbCrLf & _
" Point 2: " & ShowPoint(extent2, uom)
MsgBox result
Debug.Print result
End If
Next
End Sub
Private Function ShowPoint(InPoint As Point, uom As UnitsOfMeasure) As String
ShowPoint = uom.GetStringFromValue(InPoint.X, kDefaultDisplayLengthUnits) & _
", " & uom.GetStringFromValue(InPoint.Y, kDefaultDisplayLengthUnits) & _
", " & uom.GetStringFromValue(InPoint.Z, kDefaultDisplayLengthUnits)
End Function