Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Part "Save As" Journal, Cant use "__00" for name suffix?

Status
Not open for further replies.
Let me explain a little better...

I'm using NX Native revision controls.
The File naming suffix drives the revision and what part to load.

__00 = Rev -
__01 = Rev A
__02 = Rev B
& so on.

The Journal below is what I've used for a long time to re-name parts

For some crazy reason if I attempt to rename...

XXXXX_PN-001.prt to XXXXX_PN-001__00.prt or __01.prt etc...
it just doesn't do it

But if I rename the entire name it works

This_dumb_part.prt to XXXX_PN-001__00.prt

That works!?


Is there something in this journal restricting the naming when it comes to underscores????

Option Strict Off

Imports NXOpen
Imports NXOpen.UF
Imports System
Imports System.IO
Imports System.Environment
Imports System.Windows.Forms

Module Renomear

Dim s As Session = Session.GetSession()
Dim ufs As UFSession = UFSession.GetUFSession()

Sub Main()

Dim theSession As Session = Session.GetSession()
Dim lw As ListingWindow = s.ListingWindow()
Dim workPart As Part = s.Parts.Work
Dim displayPart As Part = s.Parts.Display

If workPart Is Nothing Then Return

Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Renomear")

Dim filename As String = ""
Dim wpPath As String = workPart.FullPath
filename = wpPath

If (select_file(filename) <> DialogResult.OK) Then
Return
Else
Dim partSaveStatus1 As PartSaveStatus
Try
partSaveStatus1 = workPart.SaveAs(filename)
Catch ex As NXException
lw.WriteLine("SaveAs of part " & filename & _
" failed with error code " & ex.ErrorCode & vbCrLf)
lw.WriteLine(ex.ToString)
End Try
End If

End Sub

Public Function select_file(ByRef filename) As DialogResult

Dim sfd As SaveFileDialog = New SaveFileDialog()
Dim result As DialogResult

sfd.Title = "Choose new part file name"
sfd.AddExtension = True
sfd.DefaultExt = "prt"
sfd.FileName = filename

result = sfd.ShowDialog()
filename = sfd.FileName
sfd.Dispose()
Return result

End Function

Public Function GetUnloadOption(ByVal dummy As String) As Integer
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately
End Function

End Module

TIA


Dave
Automotive Tooling / Aircraft Tooling / Ground Support Structures

NX9, Win 7 Pro SP1
 
Do you get any sort of error or warning message?

Using NX 9 (on Windows 7), I created a test part named 12345_PN-001.prt and used the journal to save-as to 12345_PN-001__00.prt; the journal successfully performed the save-as.

www.nxjournaling.com
 
No there were no warnings at all.... it was weird.

It's behaving well now tho. I think it may have been an under spec machine getting a little overwhelmed?

I'll be keeping an eye on it.



Dave
Automotive Tooling / Aircraft Tooling / Ground Support Structures

NX11, Win 10 Pro
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor