Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

can journaling force save open files

Status
Not open for further replies.

multicaduser

Industrial
Jan 29, 2013
261
NX 8.0.3.4
Windows 7 Service Pack 1
NAS file system across fiber optics

I'm having an issue with our file servers that our IT department is unable to solve. The problem is that modified files are being reported "saved" in NX, but on re-opening them not all files are saved in their latest state. As an example an assembly file was re-opened after the save-all, and components were missing. The component was on the file system, and had all the geometry including wave-linked geometry, which was created in the assembly. Another file in the same assembly which was modified after the missing part was created, was in a state previous to the creation of the missing component.

Another instance was in creating a stand-alone file, NX reported the save successful, but it didn't show up in the file system. Repeted tries at saving using all the options and "refreshing" windows-explorer did not show the file on disk. Doing a "save-as" by just removing the ".prt" frome the file name saved the part and showed it on disk.

Supposedly disk caching, and a routine that "compares" files and maximized disk usage has been turned off, so our IT department is at the end of what it knows to do.

My question, after all that, is there a way, through journaling perhaps, to "force save" all open parts?
 
Replies continue below

Recommended for you

A journal just gives you programmatic access to functions in NX. The "save" function in a journal doesn't do anything special that the interactive toolbar button or menu pick doesn't do. At best, you might be able to write some code that checks to make sure the part files exist on disk after performing a save, but this is only a band-aid - not a real solution.

Perhaps your IT coworkers might make more headway if you introduce them to (eng-tips' sister site for IT topics).

www.nxjournaling.com
 
Thanks cowski, that's what I thought. Is there any way to force a modified flag on all open parts then step through and save each one? Your answer on the tips site makes the most sense to me, wish it were that easy.
 
Here's a quick journal I put together that will report the status of all the parts in session (does it exist on disk and if so, list the last save timestamp), attempt to save all the modified parts, and report the new status of the parts.

Code:
Option Strict Off
Imports System
Imports NXOpen

Module Module1

    Sub Main()

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

        For Each tempPart As Part In theSession.Parts
            lw.WriteLine("before save")
            lw.WriteLine(tempPart.FullPath)
            lw.WriteLine("file exists on disk: " & IO.File.Exists(tempPart.FullPath).ToString)
            If IO.File.Exists(tempPart.FullPath) Then
                Dim infoReader As System.IO.FileInfo
                infoReader = My.Computer.FileSystem.GetFileInfo(tempPart.FullPath)
                lw.WriteLine("File was last modified on " & infoReader.LastWriteTime)

            End If

            lw.WriteLine("")
        Next

        theSession.Parts.ForceSaveAll()

        For Each tempPart As Part In theSession.Parts
            lw.WriteLine("after save")
            lw.WriteLine(tempPart.FullPath)
            lw.WriteLine("file exists on disk: " & IO.File.Exists(tempPart.FullPath).ToString)
            If IO.File.Exists(tempPart.FullPath) Then
                Dim infoReader As System.IO.FileInfo
                infoReader = My.Computer.FileSystem.GetFileInfo(tempPart.FullPath)
                lw.WriteLine("File was last modified on " & infoReader.LastWriteTime)

            End If

            lw.WriteLine("")
        Next

    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
 
Just got in from a long weekend this morning and tried it.....thanks for your help. Will have to study your journal and learn, I like the way you code. All automation and programming here is self taught so this program is a great resource for me. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor