Remove/Replace Links

[ Edited ]

Good evening!

&Sorry for my English!


I have a few questions:

For example, i have two ASM files: c:\folder1\first.asm, c:\folder2\second.asm

first.asm has two links to two files c:\folder1\first.par and c:\folder1\second.par

second.asm has two links to two files c:\folder2\first.par and c:\folder2\second.par

Files c:\folder1\first.par and c:\folder2\first.par are the same

Files c:\folder1\second.par and c:\folder2\second.par are the same too


I want to change links in the next way:

first.asm has link to c:\folder1\first.par and c:\folder1\second.par

second.asm has link to c:\folder1\first.par and c:\folder1\second.par


So, I need to remove old link and to made a new link?

Or, I need to replace old link with new link?


What method should I use?




application = new RevisionManager.Application();

document = (Document)

application.Open(sourceFilePath, RevisionRuleType.LatestRevision, false);


linkedDocuments = (LinkedDocuments)



for (var i = 1; i <= linkedDocuments.Count; i++)


linkedDocument = linkedDocuments.Item[i] as Document;







I do it in right way?

Or I need to use RedefineLinks method?


Can someone write a little example? VB or C#?


Thanks a lot!!!


Posted by: Nick
Post date: 3/1/2012 10:24:09 AM


Re: Remove/Replace Links

[ Edited ]



open the file second.asm via the RevisionManager.Application object, traverse its LinkedDocuments collection and set the path of each LinkedDocument which path you want to replace with a new path via its method SetPath.


Posted by: Wolfgang Kunert
Post date: 3/2/2012 3:10:56 AM

Remove/Replace Links

[ Edited ]

Hello Nick, hello Wolfgang,


the solution you offer works perfectly for assemblies and parts but doesnt seem to update paths to linked documents for drafts.. Any idea why or how could it be done?


Thanks in advance,




Posted by: Salwadora
Post date: 1/14/2013 8:35:04 AM

Remove/Replace Links

[ Edited ]

well, thats sad..


I have a 3D Model and a draft linked to the .asm file of this model and whenever I need to copy it to another directory I have to reistablish the links in revisison manager. So I am doing it like this:


Dim reApp As RevisionManager.Application

Dim reDoc, reDoc1 As RevisionManager.Document

Dim reLinkedDocs As RevisionManager.LinkedDocuments

Dim reLink As RevisionManager.Document = Nothing



reApp = DirectCast(CreateObject("RevisionManager.Application"), RevisionManager.Application)


reDoc = DirectCast(reApp.Open(NewPath + "Zusammenbau.asm"), RevisionManager.Document)

reLinkedDocs = DirectCast(reDoc.LinkedDocuments, RevisionManager.LinkedDocuments)


'replacing the links for a 3D Model

For Each reLink In reLinkedDocs

If reLink.FullName.Substring(reLink.FullName.LastIndexOf("\") + 1) = "Siebkasten.asm" Then

reLink.Replace(NewPath + "\Siebkasten\Siebkasten.asm")

End If




' replacing links for a draft (it linked to Zusammenbau.asm which i updated above

reDoc1 = DirectCast(reApp.Open(NewPath + fName + ".dft"), RevisionManager.Document)

reLinkedDocs = DirectCast(reDoc1.LinkedDocuments, RevisionManager.LinkedDocuments)

For Each reLink In reLinkedDocs

If reLink.FullName.Substring(reLink.FullName.LastIndexOf("\") + 1) = "Zusammenbau.asm" Then

reLink.Replace(strASMFile + "Zusammenbau.asm")


End If



Catch ex As Exception






reApp = Nothing

reDoc = Nothing

reLinkedDocs = Nothing

End Try




Is there any way to update these links for a draft file? After copying files elsewhere the draft file is still linked to asm in old location which doesnt exist...


Any help is highly appreciated


Posted by: Salwadora
Post date: 1/15/2013 2:32:06 AM

Remove/Replace Links

[ Edited ]

tried it, didnt work..


Posted by: Salwadora
Post date: 1/15/2013 4:29:39 AM

Remove/Replace Links

[ Edited ]

Hello Wolfgang,


i dont know what the problem was. Not mine neither your code would work for me. So i created another project, recreated there all my classes and modules from the old project and now it works perfectly. Whatever coused my problem now its sloved.


Thank you very much for your help, i really appreciate it!





Posted by: Salwadora
Post date: 1/17/2013 1:43:21 AM