Hello Inventor - vb.net Visual Studio - getting started

Hello Inventor - vb.net Visual Studio - getting started

andrew_canfield
Collaborator Collaborator
1,010 Views
8 Replies
Message 1 of 9

Hello Inventor - vb.net Visual Studio - getting started

andrew_canfield
Collaborator
Collaborator

Some of my previous requests relate to a grand idea to import a list of files into Inventor for further processing - printing, converting, replacing references on drawings, shrinkwrapping - a little like the task scheduler but the list can be exported from the PDM system & imported to excel & tweaked accordingly.

A VBA version to replace drawing references has been produced but VBA is 'unsupported' so a VB.net tool is being sort. (thanks: https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/set-drawing-scale-from-list-using-vb... )

My guess is to move data between Excel & Inventor I need a better understanding of sub, function, public & private - relating to Inventor & Excel & how the lines of code target the information - there is a lot of code available & I can have it trigger error messages.

 

Here is 'Hello Inventor' - just finding code to launch Inventor took some searching..

HelloInventor.png

 

After creating a windows form this was added  in the button sub  & it works, as in it will open Inventor:

       Dim proc As New System.Diagnostics.Process()

        proc = Process.Start("C:\Program Files\Autodesk\Inventor 2018\Bin\Inventor.exe", "")

        Dim oPart As Document
        Dim oPartPath As String
        Dim Thisdoc As Inventor.Document

It was just a test to see how to open Inventor ( ideally Apprentice will be used for the finished tool).

Further testing to open specific files is throwing up errors which don't happen in iLogic because iLogic sits on Inventor & Visual Studio is outside Inventor. This project is to chop & change from file to file which (I'm advised) isn't iLogic friendly. ( also compared to iLogic efforts the VBA version is fast!).

 

The code between lines 18-35 was pasted in from an iLogic post with the intention it could be converted but the error messages are stumbling blocks.

 

Lines 33/34 are for the next test - have them opened/closed in Inventor by the form - just to test it can be done.

 

Great to see this tutorial:

http://www.hjalte.nl/60-creating-an-inventor-addin 

 

Would be ideal if a pure vb.net version could be offered ( @JelteDeJong ) ; I did read if there are other ideas out there forward them on!

 

Back to the search...

 

Regards

 

Andrew

 

Regards

 

Andrew

 

0 Likes
1,011 Views
8 Replies
Replies (8)
Message 2 of 9

bradeneuropeArthur
Mentor
Mentor

bradeneuropeArthur_0-1671626064391.png

 

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 3 of 9

andrew_canfield
Collaborator
Collaborator

Thankyou, trying to figure this out..

'<typename>' is an interface type and cannot be used as an expression
A type name occurs where an expression is required. An expression must consist of a combination of variables, constants, literals, properties, and Function procedure calls.
Error ID: BC30111

Interfacetype.PNG

Regards

 

Andrew

0 Likes
Message 4 of 9

JelteDeJong
Mentor
Mentor

As far as I know, is the entire tutorial in pure VB.net. So I'm not sure what you would like to see.

If you want to create a standalone application then you might want to have a look at the 3e part of the tutorial "Debugging without restating Inventor".

There I create a application that connects to Inventor and runs as a standalone application. Here are the basics for getting the Inventor object. (It will start Inventor if it is not started jet.)

Dim ThisApplication As Inventor.Application

Try
    ThisApplication = Runtime.InteropServices.Marshal.GetActiveObject("Inventor.Application")
Catch ex As Exception
    Dim oType As Type = Type.GetTypeFromProgID("Inventor.Application")
    ThisApplication = System.Activator.CreateInstance(oType)
    ThisApplication.Visible = True
End Try

Dim ThisDoc As Document = ThisApplication.ActiveDocument

 

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 5 of 9

andrew_canfield
Collaborator
Collaborator

Thanks for the reply.

Think I've started off on the wrong foot (again), used a windows form & not a method?

Not 100% sure - trying again with a different template.

Misunderstood the iLogic tutorial.

method.PNG

 

Regards

 

Andrew

0 Likes
Message 6 of 9

andrew_canfield
Collaborator
Collaborator

Many thanks for the effort that's gone into the tutorials - I have a button!

Need to figure out how to use the button now.

 

Working through MyDebug & not seeing ThisRule() to add as a reference - should ThisRule() have a .dll?

 

Progressing, slowly..

thisRuledll.PNG

 

Regards

 

Andrew

0 Likes
Message 7 of 9

andrew_canfield
Collaborator
Collaborator

Forgive my ignorance.. is the 'myiLogicAddin' designed to allow iLogic to run from VB.net?

When adding an iLogic line of code a 'Not Declared' error is returned.

 

GoExcel.PNG

Regards

 

Andrew

0 Likes
Message 8 of 9

bradeneuropeArthur
Mentor
Mentor

No that will not work!

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 9 of 9

andrew_canfield
Collaborator
Collaborator

Thanks.

0 Likes