COPY ASSEMBLY FILE WITH ITS PART FILES AND LIKS

Valued Contributor
Valued Contributor

Hello All,

 

Am trying to create a local copy  of an assembly including its part files, code runs and it creates new files but new parts are linked to source assembly and I need them to be linked to the new assembly; here is my code, and files ( for some reasons web site does not let me upload assembly file, changed the extension to txt, please change it to asm)

 

Public Sub copyFiles(ByVal sourceName As String, ByVal source() As String, ByVal destination() As String, ByVal fileFO As String, Optional insightServer As Boolean = False, Optional updateDraftDocs As Boolean = False, Optional showRevMgr As Boolean = False)
If source.Length = destination.Length Then
Dim objRevMgr As RevisionManager.Application = Nothing
Dim objInsight As RevisionManager.Insight = Nothing
Dim filesSource(source.Length - 1) As Object
Dim filesDestination(destination.Length - 1) As Object

Try
' Start Revision Manager.
objRevMgr = New RevisionManager.Application
If showRevMgr = True Then
objRevMgr.Visible = True
End If
' Get reference to Insight object.
objRevMgr.DisplayAlerts = False
objInsight = objRevMgr.Insight

For i As Integer = 0 To source.Length - 1
filesSource(i) = source(i)
filesDestination(i) = destination(i)
Next
'' Copy files here
objInsight.CopyFiles(sourceName, filesSource, filesDestination)

Catch ex As Exception

' Write any errors to console.
Console.WriteLine(ex.Message)
Finally
releaseCOMobjects(objRevMgr)
releaseCOMobjects(objInsight)
End Try
End If
End Sub

 

 

1 REPLY

Re: COPY ASSEMBLY FILE WITH ITS PART FILES AND LIKS

Valued Contributor
Valued Contributor

hi,

you didnt replace the link. you copied the files to new location.

 

Access assembly linked parts & then replace the linked parts with new location parts,

 

objLinDocs = objDoc.LinkedDocuments'----your assembly linked docs

 

objLinDoc = objLinkedDocuments.Item(---)'----select item to replace with the new location & part name---

 

objLinkedDocument.Replace("GIVE NEW PATH & NEW PART FILE NAME")