Linear and circular pattern features

Dear All,
I'm having probems with linear and circular pattern, I need to know the input (i.e. driving) feature of those
patterns, but all I'm managing to do is to have a list of the instances but these are all features of
type INSTANCE while I need to access the feature I used to create the pattern in the first place (for example an hole).

I tried in many ways but couldn't find a way out, my last try was the following

Dim features As NXOpen.Features.FeatureCollection = part.Features()
For Each feature As NXOpen.Features.Feature In features
If feature.FeatureType = "LINEAR_ISET" Or feature.FeatureType = "CIRCULAR_ISET" Then
Dim featureList() As NXOpen.Tag
Dim num As Integer
ufSession.Modl.AskAllMembersOfSet(feature.Tag, featureList, num)
End if
Next

but I get an exception form AskAllMembersOfSet saying that the feature I'm passing is of unknown type.

Anybody knows how this could be done?

Thanks, cheers

Silvia

What version of NX and which command are you using to create the patterns?

I'm using NX 7.5 and I create a rectangular pattern using the following command

Insert > Associative Copy > Instance Feature... > Rectangular Array

Thanks, cheers

Silvia

Does the following code help?


Option Strict Off
Imports System
Imports NXOpen

Module Module1

Sub Main()

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()

For Each tempFeat As Features.Feature In workPart.Features
'FeatureType: LINEAR_ISET
'FeatureType: CIRCULAR_ISET

If tempFeat.FeatureType = "LINEAR_ISET" Or tempFeat.FeatureType = "CIRCULAR_ISET" Then

lw.WriteLine("pattern found: " & tempFeat.GetFeatureName)

Dim tempParents() As Features.Feature
tempParents = tempFeat.GetParents
lw.WriteLine("parent features:")
For Each pFeat As Features.Feature In tempParents
lw.WriteLine(" " & pFeat.GetFeatureName)
Next
lw.WriteLine("")

End If

Next

End Sub

End Module

Thanks for your help,
unfortunately even using this code I get as parent features
objects of generic type "BodyFeature" and FeatureType is still INSTANCE.

This is an example of what I get printing out feature name and feature type

Transform Array(3) TRANSFORM_ISET
Instance[0](3)/Counterbored Screw Hole(3) INSTANCE

From the name I have an indication that the feature is a hole, but the object returned is
still an INSTANCE.
It seems very hard to find a link to the feature used to create the pattern.

How about this?

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

Sub Main()

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession
Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()

For Each tempFeat As Features.Feature In workPart.Features
'FeatureType: LINEAR_ISET
'FeatureType: CIRCULAR_ISET

If tempFeat.FeatureType = "LINEAR_ISET" Or tempFeat.FeatureType = "CIRCULAR_ISET" Then

lw.WriteLine("pattern found: " & tempFeat.GetFeatureName)

Dim tempParents() As Features.Feature
tempParents = tempFeat.GetParents
lw.WriteLine("parent features:")
For Each pFeat As Features.Feature In tempParents
lw.WriteLine(" name: " & pFeat.GetFeatureName)
lw.WriteLine(" type: " & pFeat.FeatureType)
If pFeat.FeatureType.ToUpper = "INSTANCE" Then
Dim masterTag As Tag
theUfSession.Modl.AskMaster(pFeat.Tag, masterTag)
Dim masterFeature As Features.Feature
masterFeature = Utilities.NXObjectManager.Get(masterTag)
lw.WriteLine(" ** master feature: " & masterFeature.GetFeatureName)
lw.WriteLine(" ** master feature type: " & masterFeature.FeatureType)
End If
Next
lw.WriteLine("")

End If

Next

End Sub

End Module

Thanks that was it!
I can access the master feature now.
Thank you so much.