Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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
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