Forums:
Hi
I'm looking for a journal that will make a user select a symbolic thread.
I only found a code that reads data from every symbolic thread in work part.
Here’s the code:
Thank you
Imports System Imports NXOpen Imports NXOpen.UF Public Class NXJournal Shared theSession As Session = Session.GetSession() Shared theUFSession As UFSession = UFSession.GetUFSession() Shared workPart As Part = theSession.Parts.Work Private Shared Sub DoIt() For Each aFeature As NXOpen.Features.Feature In workPart.Features If aFeature.FeatureType.Equals("SYMBOLIC_THREAD") Then Echo(aFeature.GetFeatureName()) Dim data As UFModl.SymbThreadData = New UFModl.SymbThreadData() theUFSession.Modl.AskSymbThreadParms(aFeature.Tag, data) ' Echo(" Angle: " & data.angle) ' Echo(" Axis: " & data.axis_direction(0) & " " + data.axis_direction(1) & " " + data.axis_direction(2)) If data.callout.Length > 1 Then Echo(" Callout: " & data.callout) Else Echo(" Callout: None (manual input)") End If Echo(" CylFace: " & data.cyl_face.ToString()) Echo(" Form: " & data.form) Echo(" IncludeInstances: " & data.include_instances.ToString()) Echo(" InternalThread: " & data.internal_thread.ToString()) Echo(" Length: " & data.length) Echo(" LengthFlag: " & data.length_flag.ToString()) Echo(" MajorDia: " & data.major_dia) Echo(" Method: " & data.method) Echo(" MinorDia: " & data.minor_dia) Echo(" NumStarts: " & data.num_starts.ToString()) Echo(" Pitch: " & data.pitch) Echo(" Rotation: " & data.rotation) Echo(" StartFace: " & data.start_face.ToString()) Echo(" Tapered: " & data.tapered.ToString()) Echo(" TappedDia: " & data.tapped_dia) End If Next End Sub Public Shared Sub Main(ByVal args As String()) If workPart IsNot Nothing Then DoIt() Return End If Dim loadStatus As PartLoadStatus For ii As Integer = 0 To args.Length - 1 Echo("Processing: " & args(ii)) workPart = CType(theSession.Parts.OpenBaseDisplay(args(ii), loadStatus), Part) reportPartLoadStatus(loadStatus) If workPart IsNot Nothing Then DoIt() workPart.Close(BasePart.CloseWholeTree.[True], BasePart.CloseModified.CloseModified, Nothing) End If Next End Sub Private Shared Sub Echo(ByVal output As String) theSession.ListingWindow.Open() theSession.ListingWindow.WriteLine(output) theSession.LogFile.WriteLine(output) End Sub Private Shared Sub reportPartLoadStatus(ByVal load_status As PartLoadStatus) If load_status.NumberUnloadedParts = 0 Then Return Echo(" Load notes:") For ii As Integer = 0 To load_status.NumberUnloadedParts - 1 Echo(" " & load_status.GetPartName(ii) & " - " + load_status.GetStatusDescription(ii)) Next End Sub Public Shared Function GetUnloadOption(ByVal arg As String) As Integer Return System.Convert.ToInt32(Session.LibraryUnloadOption.Immediately) End Function End Class