×
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

Hole Series w/NX Open

Hole Series w/NX Open

Hole Series w/NX Open

(OP)
Does anyone have any experience with modifying Hole Series between components in NX/Open. From an assembly, I am trying to determine what the component parts are referenced by the Hole Series.

Thank you,
-Pat

Thank you,
-Pat

RE: Hole Series w/NX Open

(OP)
I have found this command: GetHoleSeriesStartHoleFeature but can't seem to get it to work...
-Pat

Thank you,
-Pat

RE: Hole Series w/NX Open

Here is some code that may get you started; open an assembly that has at least 1 hole series feature and run the journal. It will list the hole series feature and the components used in that hole series feature.

CODE

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Features


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

        Dim featArray() As Feature = theSession.Parts.Work.Features.GetFeatures()

        For Each myFeature As Feature In featArray

            If myFeature.FeatureType.ToUpper = "HOLE ORCHESTRATION" Then

                lw.WriteLine("feature: " & myFeature.GetFeatureName)

                Dim holeSeries As HolePackage = myFeature
                Dim holeBuilder As HolePackageBuilder
                holeBuilder = workPart.Features.CreateHolePackageBuilder(holeSeries)

                Dim startBodies() As Body
                startBodies = holeBuilder.StartHoleData.BooleanOperation.GetTargetBodies()

                Dim middleBodies() As Body
                middleBodies = holeBuilder.MiddleHoleData.BooleanOperation.GetTargetBodies

                Dim endBodies() As Body
                endBodies = holeBuilder.EndHoleData.BooleanOperation.GetTargetBodies

                lw.WriteLine("start body component: " & startBodies(0).OwningComponent.Name & " (" & startBodies(0).Prototype.OwningPart.FullPath & ")")

                For Each tempBody As Body In middleBodies
                    lw.WriteLine("middle body component: " & tempBody.OwningComponent.Name & " (" & tempBody.Prototype.OwningPart.FullPath & ")")
                Next

                lw.WriteLine("end body component: " & endBodies(0).OwningComponent.Name & " (" & endBodies(0).Prototype.OwningPart.FullPath & ")")

            End If
        Next

        lw.WriteLine("")
        lw.Close()


    End Sub


    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image when the NX session terminates
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

    End Function

End Module 

www.nxjournaling.com

RE: Hole Series w/NX Open

(OP)
Thanks Cowski,

I got this working but now another question lets say that the startbody is your work part, you have a linked hole feature in the browser. How can you figure out the parent feature/part would be?

-Pat

Thank you,
-Pat

RE: Hole Series w/NX Open

Try the code below...

CODE

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Features
Imports NXOpen.UF


Module Module1

    Sub Main()

        Dim theSession As Session = Session.GetSession()
        Dim workPart As Part = theSession.Parts.Work
        Dim theUFSession As UFSession = UFSession.GetUFSession

        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        Dim featArray() As Feature = theSession.Parts.Work.Features.GetFeatures()

        For Each myFeature As Feature In featArray
            'lw.WriteLine(myFeature.GetFeatureName)
            'lw.WriteLine(myFeature.FeatureType)
            'lw.WriteLine("")

            If myFeature.FeatureType.ToUpper = "HOLE ORCHESTRATION" Then

                lw.WriteLine("feature: " & myFeature.GetFeatureName)

                Dim holeSeries As HolePackage = myFeature
                Dim holeBuilder As HolePackageBuilder
                holeBuilder = workPart.Features.CreateHolePackageBuilder(holeSeries)

                Dim startBodies() As Body
                startBodies = holeBuilder.StartHoleData.BooleanOperation.GetTargetBodies()

                Dim middleBodies() As Body
                middleBodies = holeBuilder.MiddleHoleData.BooleanOperation.GetTargetBodies

                Dim endBodies() As Body
                endBodies = holeBuilder.EndHoleData.BooleanOperation.GetTargetBodies

                lw.WriteLine("start body component: " & startBodies(0).OwningComponent.Name & " (" & startBodies(0).Prototype.OwningPart.FullPath & ")")

                For Each tempBody As Body In middleBodies
                    lw.WriteLine("middle body component: " & tempBody.OwningComponent.Name & " (" & tempBody.Prototype.OwningPart.FullPath & ")")
                Next

                lw.WriteLine("end body component: " & endBodies(0).OwningComponent.Name & " (" & endBodies(0).Prototype.OwningPart.FullPath & ")")

            End If

            If myFeature.FeatureType.ToUpper = "LINKED HOLE PACKAGE" Then
                lw.WriteLine("linked hole package found")
                Dim sourceTag As Tag
                Dim linkBroken As Boolean = True
                theUFSession.Wave.IsLinkBroken(myFeature.Tag, linkBroken)
                If linkBroken Then
                    lw.WriteLine("link to parent geometry is broken")
                Else
                    theUFSession.Wave.AskLinkSource(myFeature.Tag, True, sourceTag)
                    If sourceTag = Tag.Null Then
                        lw.WriteLine("could not fully load parent file...")
                    Else
                        Dim myTaggedObj As TaggedObject
                        Dim sourceFeature As HolePackage
                        Dim sourceFile As Part
                        myTaggedObj = theSession.GetObjectManager.GetTaggedObject(sourceTag)
                        sourceFeature = myTaggedObj
                        sourceFile = sourceFeature.OwningPart
                        lw.WriteLine("parent file: " & sourceFile.FullPath)
                        lw.WriteLine("parent feature: " & sourceFeature.GetFeatureName)

                    End If

                End If

            End If

        Next

        lw.WriteLine("")
        lw.Close()


    End Sub


    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image when the NX session terminates
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

    End Function

End Module 

www.nxjournaling.com

RE: Hole Series w/NX Open

how to use this code in ug

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