×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Rename parts

Rename parts

Rename parts

(OP)
Hi.

Is there a easy way to rename parts in a assembly.
I have to rename all my parts in my assembly?

RE: Rename parts

I just perform a "Save As" on every part. It's my method of part numbering and I use the file name itself in the BOM. Keeps the docs in lock step with the model.

Dave
Automotive Tooling / Aircraft Tooling / Ground Support Structures

NX9, Win 7 Pro SP1

RE: Rename parts

Look up Cloning both in this forum and in the NX help doc
When you rename, is the new name totally unique to the "old" name?

RE: Rename parts

Yeah, cloning is good for dealing with an assembly level re-name of all parts.
Ex: a Job# prefix (or suffix) to your all existing part numbers.

Not sure but I think the "re-name" option may be limited to being used on one part at a time.

Dave
Automotive Tooling / Aircraft Tooling / Ground Support Structures

NX9, Win 7 Pro SP1

RE: Rename parts

I use a script to rename a part:

CODE --> Off

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 

Gelson Z. Nicoletto
Eng. Supervisor
Mould Desing
Brazil

RE: Rename parts

Nice.... It works perfectly and a lot less effort. I've got a big job to re-name tomorrow and will put it to good use.

Thanks!

Dave
Automotive Tooling / Aircraft Tooling / Ground Support Structures

NX9, Win 7 Pro SP1

RE: Rename parts

I need to learn some journaling. It's obviously a powerful tool and I've got to many tasks that could be executed at a key stroke.

Dave
Automotive Tooling / Aircraft Tooling / Ground Support Structures

NX9, Win 7 Pro SP1

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources