How to start inventor, open file, and save it

How to start inventor, open file, and save it

Anonymous
Not applicable
2,110 Views
7 Replies
Message 1 of 8

How to start inventor, open file, and save it

Anonymous
Not applicable
How do you start Inventor in Visual Basic, open an inventor file, and save the file as?

Thanks
0 Likes
2,111 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable
come on guys, I am sure someone knows the answer to this
0 Likes
Message 3 of 8

Anonymous
Not applicable
Have you looked at any of the sample files in the SDK folder?
C:\Users\Public\Documents\Autodesk\Inventor
2009\SDK\DeveloperTools\Samples\VB.NET\Standalone Applications\Inventor

--
KWiKMcad
Kent Keller
"FunkyFresh" wrote in message news:6398939@discussion.autodesk.com...
come on guys, I am sure someone knows the answer to this
0 Likes
Message 4 of 8

Anonymous
Not applicable
Thanks, I didnt know that existed. It helped abit but still not as much as I wished.
0 Likes
Message 5 of 8

Anonymous
Not applicable
In VB.NET code, this will activate a COM instance of Inventor. Make sure you've included a reference to the Interop DLL.

Declare a variable like this:
{code}
Private m_objInventorApplication As Inventor.Application
{code}
And put this in a method to create a new instance of Inventor.
{code}
Dim t As Type = Type.GetTypeFromProgID("Inventor.Application")
m_objInventorApplication = CType(Activator.CreateInstance(t), Inventor.Application)
{code}
When your Inventor.Application.Ready is true, you're all set to start opening documents and doing stuff to it.

When you're ready to shut it down, call this:
{code}
If m_objInventorApplication IsNot Nothing Then
m_objInventorApplication.Quit()
System.Runtime.InteropServices.Marshal.ReleaseComObject(m_objInventorApplication)
m_objInventorApplication = Nothing
GC.Collect()
GC.WaitForPendingFinalizers()
GC.Collect()
End If
{code}
If you don't close a COM activated instance in your program and release it like this, then the process won't actually end.
0 Likes
Message 6 of 8

Anonymous
Not applicable
Thank you so very much. This was exactly what I was looking for.

The only question is how does it save the file at the end. In other words, I want to make sure it doesnt just quit without saving
0 Likes
Message 7 of 8

Anonymous
Not applicable
You just need to open a document using the application, do stuff to it, and use its save method. Pretty straightforward.

{code}
Dim objDocument as Inventor.Document = m_objInventorApplication.Documents.Open("My File Name")
objDocument.Save()
{code}
0 Likes
Message 8 of 8

Anonymous
Not applicable
i love you!

thank you so much
0 Likes