Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a auto save of the info window to a text file

Status
Not open for further replies.

mnash60

Materials
Feb 21, 2012
29
0
0
US
I need some assistance completing this journal file that saves the info txt file to the working folder. attached is the code i have so far.

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

Sub Main()

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

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

For Each myFeature As Features.Feature In theSession.Parts.Work.Features.GetFeatures()

If myFeature.FeatureType.ToUpper = "WELD_POINT" Then


Dim weldID As String = ""
Try
weldID = myFeature.GetStringAttribute("ID")
Catch ex As NXException
Continue For
End Try

Dim weldX As Double
Try
weldX = myFeature.GetRealAttribute("X_Pos")
Catch ex As NXException
Continue For
End Try

Dim weldY As Double
Try
weldY = myFeature.GetRealAttribute("Y_Pos")
Catch ex As NXException
Continue For
End Try

Dim weldZ As Double
Try
weldZ = myFeature.GetRealAttribute("Z_Pos")
Catch ex As NXException
Continue For
End Try

lw.WriteLine("SpotWeld #" & weldID & ", " & "X=" & weldX.ToString & ", " & "Y=" & weldY.ToString & ", " & "Z=" & weldZ.ToString)
lw.WriteLine("")

End If
Next

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

'----Other unload options-------
'Unloads the image immediately after execution within NX
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

'Unloads the image explicitly, via an unload dialog
'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
'-------------------------------

End Function

End Module



 
Replies continue below

Recommended for you

Status
Not open for further replies.
Back
Top