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
Thank you,
-Pat





RE: Hole Series w/NX Open
-Pat
Thank you,
-Pat
RE: Hole Series w/NX Open
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 Modulewww.nxjournaling.com
RE: Hole Series w/NX Open
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
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 Modulewww.nxjournaling.com
RE: Hole Series w/NX Open