Reply

Update links using Rev. Manager

[ Edited ]

I'm trying to modify a parametric part file in SE and then update a pre-created draft of that file using Revision Manager. However, for some reason, the draft file keeps linking back to the original part file and not the modified part file. Would appreciate if someone could point the mistake i'm making.

 

Here's the code:

 

' Function to modify the draft file and update all the links to point

' to the newly created test1.par file

Private Function ModifyDraft() As Boolean

 

Dim objViews As SolidEdgeDraft.DrawingViews

Dim objView As SolidEdgeDraft.DrawingView

Dim i As Int16

 

Try

 

UpdateRelations("C:\WINDOWS\Desktop\BP reference material\Temp\temp.dft", _ "C:\WINDOWS\Desktop\BP reference material\Temp\temp1.par")

 

DraftDocument = EdgeApplication.Documents.Open(DraftLocation)

objViews = DraftDocument.ActiveSheet.DrawingViews

For i = 1 To objViews.Count

objView = objViews.Item(i)

objView.Update()

Next

 

DraftDocument.SaveAs(SavePath + "temp1.dft")

ModifyDraft = True

 

Catch ex As Exception

ModifyDraft = False

Throw ex

 

Finally

 

DraftDocument.Close()

_modelLinks = Nothing

EdgeApplication = Nothing

objViews = Nothing

objView = Nothing

i = Nothing

 

 

EdgeApplication.Visible = True

EdgeApplication.Interactive = True

 

End Try

 

End Function

 

 

' Function that uses the Revision Manager object to update the links

Public Function UpdateRelations(ByVal dftFileToUpdate As String, _

ByVal ParFileToLinkWith As String) As Boolean

 

Dim RevMgrDoc As RevisionManager.Document

Dim ObjRevLink As RevisionManager.LinkedDocuments

Dim objRevisionDoc As Object

 

Try

RevMgrDoc = RevisionMgr.Open(dftFileToUpdate)

ObjRevLink = RevMgrDoc.LinkedDocuments

objRevisionDoc = ObjRevLink(1)

RevMgrDoc.Replace(ParFileToLinkWith)

RevMgrDoc.SaveAllLinks()

UpdateRelations = True

 

Catch ex As Exception

UpdateRelations = False

Throw ex

 

Finally

RevMgrDoc = Nothing

ObjRevLink = Nothing

objRevisionDoc = Nothing

 

End Try

 

End Function

 

Posted by: siddharth balaravi
Post date: 12/18/2006 10:22:30 PM