VB.net open Inventor Document

VB.net open Inventor Document

Anonymous
Not applicable
4,025 Views
4 Replies
Message 1 of 5

VB.net open Inventor Document

Anonymous
Not applicable
I've a bunch of examples on the net on how to open and sketch from VBA for example:

'Open a document
Dim oDraw As DrawingDocument
Set oDraw = ThisApplication.Documents.Open("C:\Test\RD.ipt")

If oDraw.DocumentType kDrawingDocumentObject Then
MsgBox "This file is not a drawing file!", vbExclamation, "Alert"
End
End If

'Capture the current sheet
Dim oSheet As Sheet
Set oSheet = oDraw.ActiveSheet

I don't have the .ActiveSheet object when I try and reference my sheet from within VB.net. My overall goal is to access the parameters of the part-> change them with DB calls -> update the .dwg file from the .ipt file. If anybody has an ideas I would love to see them.

Thanks-
Jeff
Inventor 2008
Visual Studio 2005
0 Likes
4,026 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
Perhaps I'm missing something but you are opening a Part file document then
checking the document to see if it's a Drawing document and expecting to
retrieve an instance of the current sheet?

Joe ...


wrote in message news:5789934@discussion.autodesk.com...
I've a bunch of examples on the net on how to open and sketch from VBA for
example:

'Open a document
Dim oDraw As DrawingDocument
Set oDraw = ThisApplication.Documents.Open("C:\Test\RD.ipt")

If oDraw.DocumentType kDrawingDocumentObject Then
MsgBox "This file is not a drawing file!", vbExclamation, "Alert"
End
End If

'Capture the current sheet
Dim oSheet As Sheet
Set oSheet = oDraw.ActiveSheet

I don't have the .ActiveSheet object when I try and reference my sheet from
within VB.net. My overall goal is to access the parameters of the part->
change them with DB calls -> update the .dwg file from the .ipt file. If
anybody has an ideas I would love to see them.

Thanks-
Jeff
Inventor 2008
Visual Studio 2005
0 Likes
Message 3 of 5

Anonymous
Not applicable
Joe-
I can see where things could get a bit confussing. My code that I've written is as follows:

Private Sub btnGenerateDrawings_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnGenerateDrawings.Click
Dim oApp As Inventor.Application

System.Diagnostics.Process.Start("C:\Program Files\Autodesk\Inventor 2008\Bin\Inventor.exe")

'- Sleep for 10 seconds so Inventor can load -'
System.Threading.Thread.Sleep(10000)
oApp = GetObject(, "Inventor.Application")
oApp.Documents.Open("C:\RD.ipt", True)


MsgBox(oApp.Documents.Count)
'- Access dimensions here-'
End Sub

My goal is update the dimensions from a database, update the drawing file and then save it. See we have around 85,000 part number permutations and making simple database calls, then changing the values and saving the updated dwg file would be the least labor intense method I could came up with.

Thanks-
Jeff
0 Likes
Message 4 of 5

Anonymous
Not applicable
how to release the memory after closing our applicaton..
coz each time i run my application it creates an instance of inventor process in the process list..

i want to quit the application completely..
0 Likes
Message 5 of 5

amitnkukanur
Collaborator
Collaborator

Close the process, 

Senior Software Engineer
0 Likes