Wave, save A as new revision of existing B
Wave, save A as new revision of existing B
(OP)
Hi
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?
Thanks
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?
Thanks





RE: Wave, save A as new revision of existing B
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
Thanks, can you please explain how this journal accomplishes the task?
Which steps does it perform?
Regards
RE: Wave, save A as new revision of existing B
A windows folder and then import partBrevy to TC
RE: Wave, save A as new revision of existing B
Regards
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
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.
Thanks
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 lw.Open() 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("=============================================") lw.WriteLine("pdm_master = " & pdm_master) lw.WriteLine("") lw.WriteLine("windir = " & windir) lw.WriteLine("") lw.WriteLine("win_master = " & win_master) lw.WriteLine("=============================================") '********************************************************************************************** '================ Export to native ================= '******************************************************** Try ' Determine whether the directory exists. If Directory.Exists(windir) Then lw.WriteLine(windir & " path exists already.") Else ' 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. 'di.Delete() '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.Terminate() ufs.Clone.Initialise(UFClone.OperationClass.ExportOperation) ufs.Clone.SetFamilyTreatment(UFClone.FamilyTreatment.TreatAsLost) ufs.Clone.setDefNaming(UFClone.NamingTechnique.Autotranslate) ufs.Clone.SetDefItemType ("") ufs.Clone.SetDefDirectory(windir) 'ufs.Clone.EnsureDefDirectory (windir) ufs.Clone.SetAssocFileRootDir (windir) ufs.Clone.SetDefAction(UFClone.Action.Overwrite) 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 ufs.Clone.StartIteration() Do ufs.Clone.Iterate(prt_name) 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 Else 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.GenerateReport() ufs.Clone.PerformClone (naming_failures) ufs.Clone.Terminate() '================ Import to Tce ================= Dim cnt As Integer For cnt =0 To spc_cnt ufs.Clone.Initialise(UFClone.OperationClass.ImportOperation) ufs.Clone.SetFamilyTreatment(UFClone.FamilyTreatment.TreatAsLost) ufs.Clone.setDefNaming(UFClone.NamingTechnique.Autotranslate) ufs.Clone.SetDefDirectory(windir) ufs.Clone.SetDefItemType ("") 'ufs.Clone.EnsureDefDirectory (windir) ufs.Clone.SetAssocFileRootDir (windir) ufs.Clone.SetDefAction(UFClone.Action.UseExisting) 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 ufs.Clone.StartIteration() Do ufs.Clone.Iterate(prt_name) 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("===========================================================") lw.WriteLine(" win_specs(" & cnt.ToString & ") = " & win_specs(cnt)) lw.WriteLine(" pdm_specs(" & cnt.ToString & ") = " & pdm_specs(cnt)) lw.WriteLine("===========================================================") 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.GenerateReport() ufs.Clone.PerformClone (naming_failures) ufs.Clone.Terminate() Next '========================================= '********************************************************************************************** lw.Close() lw.Closewindow() 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() MyBase.New() 'This call is required by the Windows Form Designer. InitializeComponent() 'Add any initialization after the InitializeComponent() call 'TextBox1.Text = "part_B393-01" 'NX icon in top left side NXOpenUI.FormUtilities.SetApplicationIcon(Me) NXOpenUI.FormUtilities.ReparentForm(Me) 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 Me.Close() 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 Me.Close() 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) Try If disposing AndAlso components IsNot Nothing Then components.Dispose() End If Finally MyBase.Dispose(disposing) 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.SuspendLayout() ' 'btnCancel ' 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 ' 'btnOK ' 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 ' 'Label1 ' 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 ' 'Label2 ' 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 ' 'Label4 ' 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 ' 'Label5 ' 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 ' 'Label7 ' 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 ' 'TextBox1 ' 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 = "" ' 'TextBox2 ' 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 = "" ' 'TextBox4 ' 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 = "" ' 'TextBox5 ' 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 = "" ' 'TextBox7 ' 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 = "" ' 'UserInputForm ' 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.Controls.Add(Me.TextBox1) Me.Controls.Add(Me.TextBox2) Me.Controls.Add(Me.TextBox4) Me.Controls.Add(Me.TextBox5) Me.Controls.Add(Me.TextBox7) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.Label2) Me.Controls.Add(Me.Label4) Me.Controls.Add(Me.Label5) Me.Controls.Add(Me.Label7) Me.Controls.Add(Me.btnOK) Me.Controls.Add(Me.btnCancel) 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" Me.ResumeLayout(False) Me.PerformLayout() 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 ClassRE: Wave, save A as new revision of existing B
Do my journal work for you?