Open document (visible) in Inventor from vb-application

Open document (visible) in Inventor from vb-application

Anonymous
Not applicable
352 Views
1 Reply
Message 1 of 2

Open document (visible) in Inventor from vb-application

Anonymous
Not applicable
How do I open a drawingdocument in Inventor from a vb-application - visible, so I can see it open in Inventor -(if the Inventor application is allready open), and set the drawingdocument-object in the application to point to that activedocument?
0 Likes
353 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
‘declare
'Connect to a running instance of Inventor.
Dim oApp As Inventor.Application
Dim oPartDoc As PartDocument

Private Sub OpenDoc()

Dim strFile as String
On Error Resume Next
Set oApp = GetObject(, "Inventor.Application")
If Err Then
MsgBox "Inventor needs to be open first."
Exit Sub
End If

strFile = "C:\Library\Test.ipt"

‘Open the part
Set oPartDoc = oApp.Documents.Open(strFile, True)

'fit part to view
oApp.ActiveView.Fit

End Sub
0 Likes