Is it possible to replace the ModelLink of a DrawingView in the DraftDocument environment?
I have a DrawingView linked to a file called bolt1.par and I want to modify it to bolt2.par, holding the XY position and the DrawingView size, in addition to maintaining orientation of the view of the drawing.
Is it possible?
========================== Kabir Costa Industrial Designer firstname.lastname@example.org
The following vb code might do what you need (you can probably refactor this to be smaller):
Dim draftDoc = seApp.ActiveDocument
Dim newFilePath As String = "YourNewFileName"
Dim dvs As DrawingViews = draftDoc.ActiveSheet.DrawingViews()
Dim dv As DrawingView = dvs.Item(1) 'Or your own way of selecting the View
Dim ml2 As ModelLink = dv.ModelLink
For i = 1 To draftDoc.ModelLinks.Count
Dim ml1 As ModelLink = draftDoc.ModelLinks.Item(i)
If ml1.FileName = ml2.FileName Then
If your entire draft just contains a single ModelLink, then the following will do: