I want to cope an assemble with its referencence part to another folder and rename all the file name including ".sldpart"and "sldasm".I try the API CopyDocument.I use VB.net to programe .During the process,the date the variables get is correct,but at the last step,there is nothing in the destinate folder(the red line).I'am confused .I would appreciate it very much if anyone can help me.My code is list as follows:
.During the process,the date variables gets is listed as follows,just for example for check
sourceDoc=
sourceDoc | "D:\Solidworks_ff\jack\NOZZLE ASSEMBLE\PART\MAN_HOLE\MANHOLE\DN400\SMP_RK400.SLDASM" | String |
DestDoc=
DestDoc | "C:\Users\chenyongkang\Desktop\solidwork_test\7-26d\NOZZLE\ghj\ghj_SMP_RK400.SLDASM" | String |
sourcefiles(0)=
+ | (0) | "D:\Solidworks_ff\jack\NOZZLE ASSEMBLE\PART\MAN_HOLE\MANHOLE\DN400\RK400_SHELL.SLDPRT" {String} | Object |
targetfiles(0)=
+ | (0) | "C:\Users\chenyongkang\Desktop\solidwork_test\7-26d\NOZZLE\ghj\ghj_RK400_SHELL.SLDPRT" {String} | Object |
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''the code
Public swApp As SldWorks.SldWorks 'remark(it's in another form named form1)
Dim depends As Object
Dim sourceDoc As String
sourceDoc = "D:\Solidworks_ff\jack\NOZZLE ASSEMBLE\PART\MAN_HOLE\MANHOLE\DN" + cb_size.Text.Trim() + "\SMP_RK" + cb_size.Text.Trim() + ".SLDASM"
Dim DestDoc As String
DestDoc = Form1.AssemblyPATH + "NOZZLE" + "\" + GKFH.Text.Trim() + "\" + GKFH.Text.Trim() + "_" + "SMP_RK" + cb_size.Text.Trim() + ".SLDASM"
depends = Form1.swApp.GetDocumentDependencies2(sourceDoc, True, True, False)
If depends Is Nothing Then
Exit Sub
End If
Dim idx = 1, sourcecount = 0
Dim targetfiles(depends.Length / 2 - 1), sourcefiles(depends.Length / 2 - 1)
While idx <= depends.Length
sourcefiles(sourcecount) = depends(idx)
targetfiles(sourcecount) = Form1.AssemblyPATH + "NOZZLE" + "\" + GKFH.Text.Trim() + "\" + GKFH.Text.Trim() + "_" + sourcefiles(sourcecount).ToString().Substring(sourcefiles(sourcecount).ToString().LastIndexOf("\") + 1)
sourcecount = sourcecount + 1
idx = idx + 2
End While
Form1.swApp.CopyDocument(sourceDoc, DestDoc, sourcefiles, targetfiles, SwConst.swMoveCopyOptions_e.swMoveCopyOptionsOverwriteExistingDocs)
''''''''''''''''''''''''''''''''''''''the code
SolidworksApi macros