- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I was able to use view.copyto to copy views from a file to another file when I have the source drawing open in inventor. But when I try to copy views from an ApprenticeServerDocument, I can read view names and locations but can not copy the views. Is this because ApprenticeServerDocument can only provide access to the drawing's properties but can't use the methods of the objects? Any one can help me on this?
Dim dwgDoc As DrawingDocument
dwgDoc = _invApp.ActiveDocument
Dim dwgSheet As Sheet
dwgSheet = dwgDoc.ActiveSheet
Dim oApprentice As ApprenticeServerComponent
oApprentice = New ApprenticeServerComponent
Dim oADoc As ApprenticeServerDocument
oADoc = oApprentice.Open("D:\Drawing1.idw")
MsgBox(oADoc.DocumentType.ToString)
Dim oASheets As Sheets
oASheets = oADoc.Sheets
For Each sht As Sheet In oASheets
MsgBox(sht.Name)
Dim oADViews As DrawingViews
oADViews = sht.DrawingViews
For Each oVw As DrawingView In oADViews
MsgBox(oVw.Name & " is " & oVw.ViewType.ToString & ", at " & oVw.Position.X.ToString & ", " & oVw.Position.Y.ToString)
Try
oVw.CopyTo(dwgSheet)
Catch ex As Exception
MsgBox("Copy Faled.")
End Try
Next
Next
oADoc.Close()
oApprentice.Close()
Solved! Go to Solution.