×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

NXOpen Find Feature in by Name

NXOpen Find Feature in by Name

NXOpen Find Feature in by Name

(OP)
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

RE: NXOpen Find Feature in by Name

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources