Extract hole thread information from patterns

Dear all,
I'm trying to detect all threaded holes in a body in order to extract information about the threads which I need in a separate program.
I'm having problems with hole patterns, when I define (for example) a rectangular pattern of holes I'm not able to access single instances and to extract hole information.

For single holes I used the following code

For Each body As NXOpen.Body In part.Bodies
Dim bodyFeatures() As NXOpen.Features.Feature = body.GetFeatures()
For i As Integer = 0 To bodyFeatures.Length - 1
Dim feature As NXOpen.Features.Feature = bodyFeatures(i)
If feature.Suppressed Then Continue For

If TypeOf feature Is NXOpen.Features.BodyFeature Then
If feature.FeatureType = "HOLE PACKAGE" Or feature.FeatureType = "LINKED HOLE PACKAGE" Then
Dim holePackage As NXOpen.Features.HolePackage = feature
Dim threadData As NxThreadData = ExtractHolePackageInfo(part, holePackage)
End If
End If
Next
Next

Private Function ExtractHolePackageInfo(ByVal part As NXOpen.Part, ByRef hpFeat As NXOpen.Features.HolePackage) As NxThreadData
Dim threadData As New NxThreadData
Dim hpBuilder As NXOpen.Features.HolePackageBuilder = part.Features.CreateHolePackageBuilder(hpFeat)
Dim hType As NXOpen.Features.HolePackageBuilder.Types = hpBuilder.Type

Select Case hType
Case NXOpen.Features.HolePackageBuilder.Types.DrillSizeHole
threadData.Description = hpBuilder.DrillSize()
threadData.MajorDiameter = hpBuilder.DrillSizeHoleDiameter.Value
threadData.ThreadDepth = hpBuilder.DrillSizeHoleDepth.Value

Case NXOpen.Features.HolePackageBuilder.Types.GeneralHole, _
NXOpen.Features.HolePackageBuilder.Types.HoleSeries, _
NXOpen.Features.HolePackageBuilder.Types.ScrewClearanceHole
threadData.Description = hpBuilder.ScrewSize()
Dim hForm As NXOpen.Features.HolePackageBuilder.HoleForms = hpBuilder.ScrewClearanceHoleForm()
Dim counterboreDepth As Double = 0
Dim countersinkDepth As Double = 0
If hpBuilder.ScrewClearanceStartChamferEnabled Then
countersinkDepth = hpBuilder.ScrewClearanceStartChamferOffset.Value
End If
If hpBuilder.ScrewClearanceEndChamferEnabled Then
countersinkDepth += hpBuilder.ScrewClearanceEndChamferOffset.Value
End If
If hForm = NXOpen.Features.HolePackageBuilder.HoleForms.Counterbored Then
counterboreDepth = hpBuilder.ScrewClearanceCounterboreDepth.Value
ElseIf hForm = NXOpen.Features.HolePackageBuilder.HoleForms.Countersink Then
End If
threadData.DrillDiamter = hpBuilder.ScrewClearanceHoleDiameter.Value
threadData.ThreadDepth = hpBuilder.ScrewClearanceHoleDepth.Value - counterboreDepth - countersinkDepth

Case NXOpen.Features.HolePackageBuilder.Types.ThreadedHole
threadData.Description = hpBuilder.ThreadSize()
threadData.DrillDiamter = hpBuilder.TapDrillDiameter.Value
threadData.ThreadDepth = hpBuilder.ThreadDepth.Value
Dim expressions() As NXOpen.Expression = hpFeat.GetExpressions()
For Each expression As NXOpen.Expression In expressions
If expression.Description.ToUpper.Contains("MAJOR DIAMETER") Then
threadData.MajorDiameter = expression.Value
ElseIf expression.Description.ToUpper.Contains("MINOR DIAMETER") Then
threadData.MinorDiameter = expression.Value
ElseIf expression.Description.ToUpper.Contains("PITCH") Then
threadData.ThreadPitch = expression.Value
End If
Next
End Select

If Not String.IsNullOrEmpty(threadData.Description) Then
Return threadData
Else
Return Nothing
End If
End Function

This code completely skip patterns and also the base feature of the pattern whose type is HOLE PACKAGE throws an exception when I cast it

Dim holePackage As NXOpen.Features.HolePackage = feature

saying its type is not NXOpen.Features.HolePackage.

How patterns should be handled? Do you have any suggestions?
Thank you very much for your help.

Silvia

What version of NX are you using?

I'm using NX 7.5

Is "NxThreadData" a custom structure or class that you have created? I can't seem to find it in the API reference.

Yes, sorry for not having specified that.
NxThreadData is a little class I defined in order to collect thread info.
It is a very simple class containing the following fields

Dim mDescription As String
Dim mDrillDiameter As Double
Dim mThreadDepth As Double
Dim mNominalDiameter As Double
Dim mPitch
Dim mMajorDiameter As Double
Dim mMinorDiameter As Double

and properties to access them.

"when I define (for example) a rectangular pattern of holes I'm not able to access single instances and to extract hole information."

Won't the pattern holes have the same thread info as the parent (driving) hole?
Why not just read the parent's thread info and skip the instanced holes?

Sorry for the late answer, I've been out for work.
I'm still stuck with this problem, what you suggest would be exactly what I need, problem is I can't access the parent driving hole.
Once I create the pattern, all instances (also the first one) becomes generic "body features", the type returned by feature.FeaturetType is INSTANCE but when I print out feature.GetType.ToString I obtain NxOpen.Features.BodyFeatures from which I'm not able to extract thread info.

I also tried to locate the pattern feature, but once again I only have a feature of type LINEAR_ISET which is simply a BodyFeature and not a PatternFeature.
I don't know what else to try, any idea?

Thanks very much!