Hi ufsure and thank you for your wanting to help me.
'The code wrote in my company and I can not bring it out from company. (restriction issue)
'but this is the relevent recoded for the problem issue
'--------------------------------------------------------------
Dim pnItemType As String = Nothing
Dim addAssemblyPart As String = Nothing
ufs.Clone.Terminate()
ufs.Clone.Initialise(UFClone.OperationClass.CloneOperation)
Dim status As UFPart.LoadStatus = Nothing
ufs.Clone.SetDefFolder(":Cloned Parts")
'ufs.Clone.SetDefItemType("") ' with / without this still return nothing
'ufs.Clone.SetDefItemType("som_string") ' I tryied this and still return nothing
addAssemblyPart = "@DB/" & display_part.FullPath
ufs.Clone.AddAssembly(addAssemblyPart , status)
ufs.Clone.SetDefAction(UFClone.Action.Retain)
ufs.Clone.SetLogfile("c:\clone_log_file.txt")
' . . . . . . .
ufs.Clone.StartIteration()
Do
ufs.Clone.Iterate(prt_name)
If(prt_name = Nothing) Then Continue Do
If prt_name.Contains("/specification/") Then Continue Do
ufs.Clone.AskItemType(prt_name, pnItemType) ' this alwaisreturn nothing
If pnItemType = "UserPart" Then
ufs.Clone.SetItemType(prt_name, "UserPart")
else
ufs.Clone.SetItemType(prt_name, "ExtPart")
End If
Loop While (prt_name <> Nothing)
Dim faile As UFClone.NamingFailures = Nothing
Try
ufs.Clone.PerformClone(faile)
Catch e As Exception
lw.WriteFullLine("NX Exception = " & e.ToString)
End Try
ufs.Clone.Terminate()
'--------------------------------------------------------------
'I replaced these statements:
If pnItemType = "UserPart" Then
ufs.Clone.SetItemType(prt_name, "UserPart")
else
ufs.Clone.SetItemType(prt_name, "ExtPart")
End If
'by this statements:
ufs.Clone.SetItemType(prt_name, "UserPart")
'To check if SetItemType works and indeed works
Code:
'The code wrote in my company and I can not bring it out from company. (restriction issue)
'but this is the relevent recoded for the problem issue
'--------------------------------------------------------------
Dim pnItemType As String = Nothing
Dim addAssemblyPart As String = Nothing
ufs.Clone.Terminate()
ufs.Clone.Initialise(UFClone.OperationClass.CloneOperation)
Dim status As UFPart.LoadStatus = Nothing
ufs.Clone.SetDefFolder(":Cloned Parts")
'ufs.Clone.SetDefItemType("") ' with / without this still return nothing
'ufs.Clone.SetDefItemType("som_string") ' I tryied this and still return nothing
addAssemblyPart = "@DB/" & display_part.FullPath
ufs.Clone.AddAssembly(addAssemblyPart , status)
ufs.Clone.SetDefAction(UFClone.Action.Retain)
ufs.Clone.SetLogfile("c:\clone_log_file.txt")
' . . . . . . .
ufs.Clone.StartIteration()
Do
ufs.Clone.Iterate(prt_name)
If(prt_name = Nothing) Then Continue Do
If prt_name.Contains("/specification/") Then Continue Do
ufs.Clone.AskItemType(prt_name, pnItemType) ' this alwaisreturn nothing
If pnItemType = "UserPart" Then
ufs.Clone.SetItemType(prt_name, "UserPart")
else
ufs.Clone.SetItemType(prt_name, "ExtPart")
End If
Loop While (prt_name <> Nothing)
Dim faile As UFClone.NamingFailures = Nothing
Try
ufs.Clone.PerformClone(faile)
Catch e As Exception
lw.WriteFullLine("NX Exception = " & e.ToString)
End Try
ufs.Clone.Terminate()
'--------------------------------------------------------------
'I replaced these statements:
If pnItemType = "UserPart" Then
ufs.Clone.SetItemType(prt_name, "UserPart")
else
ufs.Clone.SetItemType(prt_name, "ExtPart")
End If
'by this statements:
ufs.Clone.SetItemType(prt_name, "UserPart")
'To check if SetItemType works and indeed works