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!

*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

Wave, save A as new revision of existing B

Wave, save A as new revision of existing B

Wave, save A as new revision of existing B


In NX9/TC10, is there a way to save one revision of file A, as a new revision of an existing file B?
Save as, new item, gives errors when file b already exists.
File, new, also fails if file b already exists.
Clone assembly also fails if file b already exists.
So far the only options are changing .prts in the UG dataset in tc, or using, file import part.
But this options can't be used when waves are used, for the cases where you want the waves to point to the new item and not the original item.

The only process I know that updates wave links is the clone assembly command, but it only work when creating revision of same item.
Is there a way to use clone assembly to create a new revision of a different item?


RE: Wave, save A as new revision of existing B

I wrote a journal to that for my company platform.
Its took me a hard work to it to fit the platform.
by trying and failed.
I don't know if it will work in your platform.

I'll have about two week to reached my code
clean it from company marks and post it

RE: Wave, save A as new revision of existing B

Hi a984928

Thanks, can you please explain how this journal accomplishes the task?
Which steps does it perform?


RE: Wave, save A as new revision of existing B

The journal export partArevx renamed to partBrevy to
A windows folder and then import partBrevy to TC

RE: Wave, save A as new revision of existing B

Interesting. Having as a journal is awesome, I will try and do it manually to see the result.

RE: Wave, save A as new revision of existing B

I'll try to post it as soon as I can

Yes you can try it manually
I used the options 'auto translate' and 'use existing'

RE: Wave, save A as new revision of existing B

a984928, I did a small test and it worked wonderfully.
Wave links were relinked correctly and the drawing didn't loose dimensions associativity.
I will do more testing but this looks very promising so far.


RE: Wave, save A as new revision of existing B

here is my journal
please tell me if its works in your platform

CODE -->

'Modified on 10 mar 2016
Option Strict Off
Imports System
Imports System.IO
Imports System.Windows.Forms  
Imports NXOpen
Imports NXOpen.UF
Module nx_manaqger_save_xpartxrev_as_ypartyrev_xyparts_exist_in_db
 Sub Main()
   Dim s As Session = Session.GetSession()
   Dim lw As ListingWindow = s.ListingWindow
   Dim ufs As UFSession = UFSession.GetUFSession

   Dim source_master As String
   Dim source_rev As String
   Dim target_master As String
   Dim target_rev As String

   Dim windir As String
   Dim windrv As String

   Dim pdm_master As String
   Dim pdm_specs(20) As String
   Dim win_master As String
   Dim win_specs(20) As String
   Dim dsn As String 'dataset name
   'create new form object
   Dim myForm As New UserInputForm
   'Dim myForm As UserInputForm = New UserInputForm(var1)

   myForm.DialogSetDefData( "part_B393-01", "-", "part_A193-01", "C", "D")
   If myForm.ShowDialog() <> DialogResult.OK Then Exit Sub

   If Not myForm.DialogGetUserData( source_master, source_rev, _
                                target_master, target_rev, windrv) Then Exit Sub
   ufs.Ui.ExitListingWindow()    ' Clear and  close the window                                                     
   windir = windrv & ":\" & target_master & target_rev & "\"

   pdm_master = "@DB/" & source_master & "/" & source_rev

   win_master = windir & target_master & "_" & target_rev & ".prt"

   lw.WriteLine("pdm_master = " & pdm_master)
   lw.WriteLine("windir = " & windir)
   lw.WriteLine("win_master = " & win_master)

'================ Export to native ================= 
    ' Determine whether the directory exists.
    If Directory.Exists(windir) Then
      lw.WriteLine(windir & "  path exists already.")

      ' Try to create the directory.
       Dim di As DirectoryInfo = Directory.CreateDirectory(windir)
       lw.WriteLine(windir & " Directory was created successfully at {0}." _
                                             & Directory.GetCreationTime(windir))
     End If

     ' Delete the directory.
     'lw.WriteLine("The directory was deleted successfully.")

   Catch e As Exception
     lw.WriteLine("The process failed: {0}." & e.ToString())
   End Try
  Dim load_status As UFPart.LoadStatus = Nothing
  ufs.Clone.SetDefItemType ("")
  'ufs.Clone.EnsureDefDirectory (windir)
  ufs.Clone.SetAssocFileRootDir (windir)
  ufs.Clone.SetLogfile(windir + "export_clone.txt")
  ufs.Clone.SetDefAssocFileCopy (True)

  ufs.Clone.AddAssembly(pdm_master, load_status)

  Dim prt_cnt As Integer = 1
  Dim spc_cnt As Integer = -1
  Dim prt_name As String

    If(prt_name = Nothing) Then Continue Do

   lw.WriteLine("Export Iterate Part  ==>>  " & prt_cnt.ToString() & "  prt_name  =  " & prt_name)
   Dim names() As String = prt_name.Split("/")
   If names(1).ToUpper = source_master.ToUpper Then

      If prt_name.ToUpper = pdm_master.ToUpper Then
        ufs.Clone.setNaming(prt_name, UFClone.NamingTechnique.UserName, win_master)
      End If

      If prt_name.Contains("/specification/") Then

        spc_cnt = spc_cnt + 1
        If spc_cnt < 9 Then
          dsn = target_master.RePlace("_", "") & "d" & "0" & (spc_cnt+1).ToString
          dsn = target_master.RePlace("_", "") & "d" & (spc_cnt+1).ToString
        End If
        win_specs(spc_cnt) = windir & target_master & "_" & target_rev & "_s_" & dsn & ".prt"
        pdm_specs(spc_cnt) = "@DB/" &  target_master & "/" & target_rev & "/specification/" & dsn  
        ufs.Clone.setNaming(prt_name, UFClone.NamingTechnique.UserName, win_specs(spc_cnt))

      End If

   End If

    prt_cnt = prt_cnt + 1
  Loop While (prt_name <> Nothing)

  Dim naming_failures As UFClone.NamingFailures = Nothing
  ufs.Clone.setdryrun (false)
  ufs.Clone.PerformClone (naming_failures)

'================ Import to Tce =================
  Dim cnt As Integer
  For cnt =0 To spc_cnt
    ufs.Clone.SetDefItemType ("")
    'ufs.Clone.EnsureDefDirectory (windir)
    ufs.Clone.SetAssocFileRootDir (windir)
    ufs.Clone.SetLogfile(windir + "import_clone" & (cnt+1).ToString & ".txt")
    ufs.Clone.SetDefAssocFileCopy (True)

    ufs.Clone.AddAssembly(win_specs(cnt), load_status)

  prt_cnt = 1

    If(prt_name = Nothing) Then Continue Do
    lw.WriteLine("Import Iterate Part  ==>>  " & prt_cnt.ToString() & "  prt_name  =  " & prt_name)
      If prt_name.ToUpper = win_specs(cnt).ToUpper Then

       lw.WriteLine("  win_specs(" & cnt.ToString & ")  =  " & win_specs(cnt))
       lw.WriteLine("  pdm_specs(" & cnt.ToString & ")  =  " & pdm_specs(cnt))

       ufs.Clone.SetAction(win_specs(cnt), UFClone.Action.Overwrite, "")

      End If
    prt_cnt = prt_cnt + 1
  Loop While (prt_name <> Nothing)

    naming_failures = Nothing
    ufs.Clone.setdryrun (false)
    ufs.Clone.PerformClone (naming_failures)

   msgbox("@DB/" & target_master & "/" & target_rev & " - Clone Done ")
 End Sub
 Public Function GetUnloadOption(ByVal dummy As String) As Integer 
   'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination 
   GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately 
   'GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Explicitly
 End Function
End Module

'                   User Input Form Dialog Class
Public Class UserInputForm

   Public Sub New()

     'This call is required by the Windows Form Designer.

     'Add any initialization after the InitializeComponent() call
     'TextBox1.Text = "part_B393-01"
     'NX icon in top left side
   End Sub

   ' Returns the data selected on the form.
   ' All parameters are output parameters.
   ' This function should only be called after this form has been
   ' shown to the user and only if the user did not cancel out of
   ' the form.
   Public Function DialogGetUserData( ByRef sn As String, _
                                      ByRef sr As String, _
                                      ByRef tn As String, _
                                      ByRef tr As String, _
                                         ByRef fd As String) As Boolean

     If Me.DialogResult <> DialogResult.OK Then Return False
         'Throw New System.Exception("Illegal GetUserData calling")

     sn = frmSrcMasterValue
     sr = frmSrcMasterRevValue
     tn = frmTargetMasterValue
     tr = frmTargetMasterRevValue
     fd = frmWinDriveValue
     Return True

   End Function

   Public Function DialogSetDefData( ByRef sn As String, _
                                      ByRef sr As String, _
                                     ByRef tn As String, _
                                      ByRef tr As String, _
                                         ByRef fd As String) As Boolean

     'If Me.DialogResult <> DialogResult.OK Then Return False
         'Throw New System.Exception("Illegal GetUserData calling")

     frmSrcMasterValue = sn
     frmSrcMasterRevValue = sr
     frmTargetMasterValue = tn
     frmTargetMasterRevValue = tr
     frmWinDriveValue = fd
     'Return True

   End Function

'*************** Private vars **************************

   Private frmSrcMasterValue As String
   Private frmSrcMasterRevValue As String
   Private frmTargetMasterValue As String
   Private frmTargetMasterRevValue As String
   Private frmWinDriveValue As String
   Private Sub UserInputForm_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
     TextBox1.Text = frmSrcMasterValue
     TextBox2.Text = frmSrcMasterRevValue
     TextBox4.Text = frmTargetMasterValue
     TextBox5.Text = frmTargetMasterRevValue
     TextBox7.Text = frmWinDriveValue
     'ttHint.SetToolTip(Me.btnOK, "Revise As")
     ttHint.SetToolTip(Me.btnOK, "Save the source master revision As a target master revision" _
                        & VbCr & "The source master must have a Spec drawing" _
                        & VbCr & "Both source and target masters exist in NX Manager Data Base" _
                        & VbCr & "Warning !!! no valid input checking " )
   End Sub
   Private Sub btnCancel_Click(sender As System.Object, e As System.EventArgs) Handles btnCancel.Click
   End Sub
   Private Sub btnOK_Click(sender As System.Object, e As System.EventArgs) Handles btnOK.Click
     frmSrcMasterValue = TextBox1.Text
     frmSrcMasterRevValue = TextBox2.Text.ToUpper
     frmTargetMasterValue = TextBox4.Text
     frmTargetMasterRevValue = TextBox5.Text.ToUpper
     frmWinDriveValue = TextBox7.Text.ToUpper
   End Sub
End Class
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class UserInputForm
    Inherits System.Windows.Forms.Form
    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            If disposing AndAlso components IsNot Nothing Then
            End If
        End Try
    End Sub
    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer
    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.btnCancel = New System.Windows.Forms.Button()
        Me.btnOK = New System.Windows.Forms.Button()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.Label5 = New System.Windows.Forms.Label()
        Me.Label7 = New System.Windows.Forms.Label()
        Me.TextBox1 = New System.Windows.Forms.TextBox()
        Me.TextBox2 = New System.Windows.Forms.TextBox()
        Me.TextBox4 = New System.Windows.Forms.TextBox()
        Me.TextBox5 = New System.Windows.Forms.TextBox()
        Me.TextBox7 = New System.Windows.Forms.TextBox()
        Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.btnCancel.Location = New System.Drawing.Point(235, 240)
        Me.btnCancel.Name = "btnCancel"
        Me.btnCancel.Size = New System.Drawing.Size(85, 30)
        Me.btnCancel.TabIndex = 0
        Me.btnCancel.Text = "Cancel"
        Me.btnCancel.UseVisualStyleBackColor = True
        Me.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.btnOK.Location = New System.Drawing.Point(20, 240)
        Me.btnOK.Name = "btnOK"
        Me.btnOK.Size = New System.Drawing.Size(85, 30)
        Me.btnOK.TabIndex = 1
        Me.btnOK.Text = "Revise As"
        Me.btnOK.UseVisualStyleBackColor = True
        Me.Label1.Location = New System.Drawing.Point(4, 30)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(160, 13)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "Save This Revision"
        Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.Label2.Location = New System.Drawing.Point(216+60, 30)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(30, 13)
        Me.Label2.TabIndex = 2
        Me.Label2.Text = "sRev"
        Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.Label4.Location = New System.Drawing.Point(0, 130)
        Me.Label4.Name = "Label1"
        Me.Label4.Size = New System.Drawing.Size(155, 13)
        Me.Label4.TabIndex = 2
        Me.Label4.Text = "As This Revision"
        Me.Label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.Label5.Location = New System.Drawing.Point(216+60, 130)
        Me.Label5.Name = "Label2"
        Me.Label5.Size = New System.Drawing.Size(30, 13)
        Me.Label5.TabIndex = 2
        Me.Label5.Text = "tRev"
        Me.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.Label7.Location = New System.Drawing.Point(15+40, 200)
        Me.Label7.Name = "Label2"
        Me.Label7.Size = New System.Drawing.Size(110, 13)
        Me.Label7.TabIndex = 2
        Me.Label7.Text = "Drive for temp files"
        Me.Label7.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.TextBox1.Location = New System.Drawing.Point(30, 51)
        Me.TextBox1.Name = "TextBox1"
        Me.TextBox1.Size = New System.Drawing.Size(166, 20)
        Me.TextBox1.TabIndex = 3
        Me.TextBox1.Text = ""
        Me.TextBox2.Location = New System.Drawing.Point(220+60, 51)
        Me.TextBox2.Name = "TextBox2"
        Me.TextBox2.Size = New System.Drawing.Size(30, 20)
        Me.TextBox2.TabIndex = 3
        Me.TextBox2.Text = ""
        Me.TextBox4.Location = New System.Drawing.Point(30, 151)
        Me.TextBox4.Name = "TextBox4"
        Me.TextBox4.Size = New System.Drawing.Size(166, 20)
        Me.TextBox4.TabIndex = 3
        Me.TextBox4.Text = ""
        Me.TextBox5.Location = New System.Drawing.Point(220+60, 151)
        Me.TextBox5.Name = "TextBox5"
        Me.TextBox5.Size = New System.Drawing.Size(30, 20)
        Me.TextBox5.TabIndex = 3
        Me.TextBox5.Text = ""
        Me.TextBox7.Location = New System.Drawing.Point(30+100+40, 200)
        Me.TextBox7.Name = "TextBox2"
        Me.TextBox7.Size = New System.Drawing.Size(20, 20)
        Me.TextBox7.TabIndex = 3
        Me.TextBox7.Text = ""
        Me.components = New System.ComponentModel.Container
        Me.ttHint = New System.Windows.Forms.ToolTip(Me.components)
        Me.AcceptButton = Me.btnOK
        Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
        Me.CancelButton = Me.btnCancel
        Me.ClientSize = New System.Drawing.Size(340, 300)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.MaximizeBox = False
        Me.MinimizeBox = False
        Me.Name = "UserInputForm"
        Me.Text = " NX Manager Revise As  -  By Tip-Eng Member"
    End Sub
    Friend WithEvents ttHint As System.Windows.Forms.ToolTip
    Friend WithEvents btnCancel As System.Windows.Forms.Button
    Friend WithEvents btnOK As System.Windows.Forms.Button
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label4 As System.Windows.Forms.Label
    Friend WithEvents Label5 As System.Windows.Forms.Label
    Friend WithEvents Label7 As System.Windows.Forms.Label
    Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
    Friend WithEvents TextBox7 As System.Windows.Forms.TextBox

End Class 

RE: Wave, save A as new revision of existing B

Hi Ibd7700

Do my journal work for you?

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! Already a Member? Login


White Paper - Reshoring Prototyping and Production
In this whitepaper, we'll provide insight into why and when it makes sense for U.S. manufacturers to reshore prototyping and production, and how companies can leverage the benefits of working with local design, prototype, and manufacturing partners during the pandemic and beyond. Download Now
Engineering Report - Top 10 Defect Types in Production
This 22-page report from Instrumental identifies the most common production defect types discovered in 2020, showcases trends from 2019 to 2020, and provides insights on how to prevent potential downtime in 2021. Unlike other methods, Instrumental drives correlations between a variety of data sources to help engineers find and fix root causes. Download Now
White Paper - Addressing Tooling and Casting Requirements at the Design Stage
Several of the tooling and casting requirements of a part can be addressed at the design stage. If these requirements are not addressed at the design stage, lot of time is spent in design iteration when the design reaches the die caster. These design issues lead to increase in time and cost of production leading to delay in time to market and reduced profits for the organization. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close