Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MintJulep on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

NXOpen Find Feature in by Name

Status
Not open for further replies.

EngProgrammer

Aerospace
Joined
Jan 14, 2015
Messages
150
Location
US
Dear Forum,

Is there an easy way to find a feature by name.

I found this in the solution center for finding a line:

Public Function getLineByFeatureName(ByVal theName As String) As Line
Dim aTag As Tag = Tag.Null
Do
theUFSession.Obj.CycleByNameAndType(workPart.Tag, theName,
UFConstants.UF_feature_type, False, aTag)
If aTag.Equals(Tag.Null) Then Exit Do

Dim lineFeature As Features.Feature =
CType(Utilities.NXObjectManager.Get(aTag), Features.Feature)
Return lineFeature.GetEntities()(0)
Loop While True

Return Nothing
End Function
 
An easier way (IMO) would be to iterate through the features collection querying the name property of each. When you find the feature with the desired name, save it and stop looking.

Code:
for each temp as features.feature in workpart.Features
  if temp.name = "magic value" then
    myFeature = temp
    exit for
  end if
next

www.nxjournaling.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top