Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Inventor instance issue

9 REPLIES 9
Reply
Message 1 of 10
NachitoMax
611 Views, 9 Replies

Inventor instance issue

Hi

 

I am having an issue with Inventor after a recent service pack update. Previously, I could run my application and it would start the correct inventor version (2015). If inventor was already running, it would connect to it. This is managed with this code-

 

        Try
            _invApp = Marshal.GetActiveObject("Inventor.Application")

        Catch ex As Exception
            Try
                Dim invAppType As Type = _
                GetTypeFromProgID("Inventor.Application")

                _invApp = CreateInstance(invAppType)
                _invApp.Visible = True

                'Note: if you shut down the Inventor session that was started
                'this(way) there is still an Inventor.exe running. We will use
                'this Boolean to test whether or not the Inventor App  will
                'need to be shut down.
                _started = True

            Catch ex2 As Exception
                MsgBox(ex2.ToString())
                MsgBox("Unable to get or start Inventor")
            End Try
        End Try

        Try
            m_oServer = New Inventor.ApprenticeServerComponent
            AddInventorPath()
        Catch ex As Exception

        End Try

Now, it is doing 2 irregular things-

 

1. even though I have no reference to inventor 2017, it starts inventor 2017 and not 2015. I am referencing V19 interop only

2. if Inventor is running, a brand new instance of inventor is created with NO SETTINGS. There are no projects available either. its like a brand new install version..

 

How can i

 

A. get the correct version I need to open

B. Stop this new instance being created and hook into the currently open inventor version?

 

 

Cheers

 

Nacho

Nacho

Automation & Design Engineer

Inventor Programmer (C#, VB.Net / iLogic)


EESignature


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.


9 REPLIES 9
Message 2 of 10
MechMachineMan
in reply to: NachitoMax

Following these threads, it looks like there is no easy way of getting the specific version. Can I ask why you need a specific version anyways?

 

https://www.experts-exchange.com/questions/28473521/How-do-you-specify-the-version-of-access-to-use-...

Also, to get the active object/create a new one, look into using the vb.net GetObject() Function

 

ie;

GetObject("", "Inventor.Application")

and

GetObject(, "Inventor.Application")

 


--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 3 of 10
NachitoMax
in reply to: MechMachineMan

Hi

 

Thanks for the reply. Reason for a specific version is:

 

My client Company have not yet moved on from 2015 although, 2 people have 2016 installed and as we all know, there is no backward compatibility for files so if 2016 edits and saves anything (which it will through the application), the remaining 2015 users will no longer be able to access those parts.

 

I will try your suggestion and report back

 

 

Cheers

 

Nacho

Nacho

Automation & Design Engineer

Inventor Programmer (C#, VB.Net / iLogic)


EESignature


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.


Message 4 of 10
MechMachineMan
in reply to: NachitoMax

Kind of what I thought. Seeing as you can't open a file that's ever been
opened and saved in 2016 in a 2015 version, I would think you need to have
a dedicated 2015 computer from which you use this code in order to actually
keep it saved down to the proper file version.

--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.

Justin K
Inventor 2018.2.3, Build 227 | Excel 2013+ VBA
ERP/CAD Communication | Custom Scripting
Machine Design | Process Optimization


iLogic/Inventor API: Autodesk Online Help | API Shortcut In Google Chrome | iLogic API Documentation
Vb.Net/VBA Programming: MSDN | Stackoverflow | Excel Object Model
Inventor API/VBA/Vb.Net Learning Resources: Forum Thread

Sample Solutions:Debugging in iLogic ( and Batch PDF Export Sample ) | API HasSaveCopyAs Issues |
BOM Export & Column Reorder | Reorient Skewed Part | Add Internal Profile Dogbones |
Run iLogic From VBA | Batch File Renaming| Continuous Pick/Rename Objects

Local Help: %PUBLIC%\Documents\Autodesk\Inventor 2018\Local Help

Ideas: Dockable/Customizable Property Browser | Section Line API/Thread Feature in Assembly/PartsList API Static Cells | Fourth BOM Type
Message 5 of 10
NachitoMax
in reply to: MechMachineMan

Easier said than done mate.

 

the bigger issue is preventing a new instance of Inventor opening everytime the application runs. Oddly enough, it doesn't behave this way when I run from VS in debug. It only behaves like this when I compile it into an executable and run it independently...

 

 

Cheers

 

Nacho

Nacho

Automation & Design Engineer

Inventor Programmer (C#, VB.Net / iLogic)


EESignature


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.


Message 6 of 10
Anonymous
in reply to: NachitoMax

Bump!

 

I realize this thread is a year and half old, but I'm having a similar (not exact, but close enough) problem and don't see a resolution. 

 

Message 7 of 10
NachitoMax
in reply to: Anonymous

Hi

 

Yes the solution to my issue was that the installer i was creating was set as administrator only. When i changed this, it resolved itself.

 

If you right click on the inventor shortcut and run as administrator, it will be like a brand new version as its not set up fort specific user (unless of course you set it up like that in the first place.

 

The standard install of Inventor is per user and all of the settings are per user also

 

 

hope that helps 🙂

 

 

Nacho

Automation & Design Engineer

Inventor Programmer (C#, VB.Net / iLogic)


EESignature


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.


Message 8 of 10
Anonymous
in reply to: NachitoMax

Thanks Nacho,
So, not the same problem I'm seeing. I'm running Visual Studio 2017 in debug mode with a VB program I wrote a while back using Inventor 2014. I've since upgraded to Inventor 2018 and now the automation is throwing an error that it can't find a running instance of Inventor or start a new one. My start up code is exactly the same as yours (looks like we both used the same example code.)
Regards,
Keith
PS: OS = Windows 10 Enterprise, Version 10.0.162999
Message 9 of 10
NachitoMax
in reply to: Anonymous

have you changed the reference to the Inventor.Interop? it need to match the current version of Inventor.

 

you can find it here:

 

C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Autodesk.Inventor.Interop\v4.0_22.0.0.0__d84147f8b4276564

Nacho

Automation & Design Engineer

Inventor Programmer (C#, VB.Net / iLogic)


EESignature


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.


Message 10 of 10
Anonymous
in reply to: NachitoMax

Thanks Nacho, that's what I was missing.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report