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: 

64 bit woes. Need help kicking off an Addin.

18 REPLIES 18
Reply
Message 1 of 19
Gruff
450 Views, 18 Replies

64 bit woes. Need help kicking off an Addin.

Hi,

 

We are using Inventor 2011. 

 

I recently switched all of our Inventor users over to 64 bit Windows 7.

 

They like the elbow room it provides but the VBA suite of 32 bit VBA programs have problems

Occasionally they crash with a 32 bit memroy error.  Or just lock up.

All 12 of these main tools work flawlessly on a 32 bit windows 7 PC.

 

I've been rewriting them as dlls that I lauch with iLogc as an interm process unfortulately I'm told that iLogic also runs as a 32 bit process.

 

Because of this I am looking into rewriting the entire suite as addins.

I am assuming running the applets in the 64 bit memory space will solve some or all  of the issues we are experiencing..

 

My problems is I  Find writing for the ribbon unintuitive, confusing and a royal pain. Still haven't made a successfull addin of this type.

 

Can one write each addin as a separate tool with embedded icons such that after loading they are available in the customize tool | commmands tab?  Perhaps under Addins?  At that point they could be added to whatever tool inside inventor manually.

 

Are there any samples or examples of how to write an addin like this?

 

Thank You,

 

Tom

18 REPLIES 18
Message 2 of 19
AlexFielder
in reply to: Gruff

A good place to start would be by downloading the Autodesk Labs Screenshot Plugin of the month from here:

 

http://labs.autodesk.com/utilities/inventor_screenshot/

 

It comes complete with the source code and will work on Inventor versions 2008 thru' 2012.

 

Within the source it defines at least one button within the RibbonBar as well as a Visual Studio Installer Project for installation purposes.

 

🙂

Message 3 of 19
Gruff
in reply to: Gruff

What is an inventor Screen Shot, What will it do to my system, and what will it do for me?

 

I Really hate to download someting when I do not know what it is.

 

I've looked at Add_in samples that supposedly add things to the riboon.  As I said I can make no sense of it.

 

This is why I am looking for a simpler way.

Message 4 of 19
nmunro
in reply to: Gruff

Unfortunately you're going to have to wade in and figure out how to do it the way the Inventor API enables you to do it. As a very basic outline you have to create a button definition (think of it as creating a button) when your add-in loads. The button definition describes the type of button, possibly images associated with the large and small versions of the button. Most importantly, you have to write some code that gets linked to the event that happens when a user clicks on your button.

 

You must then add that button to a panel on one or more ribbons. Each environment (part, assembly, sketch, etc)  in Inventor has its own set of ribbon tabs and associated panels. You can add your button to one or more of these depending on what you want to act on when the button is clicked. In addition you can define your own tab(s) and / or panel9s) and add these to the UI and place your button there.

 

It does take some commitment to become familiar with the workflow, but once you get it, it's not so bad. There are plenty of resources to help you out and provide good examples. The My First Plug In post at the top of this forum is a great place to start.

 

As usual, no free lunches Smiley Wink

 

Neil

 

        


https://c3mcad.com

Message 5 of 19
AlexFielder
in reply to: Gruff

Hi Gruff,

 

The Inventor Screenshot tool was written in response to a comment I raised on the Through-the-Interface blog; It simply allows the user to take a screenshot and save the resultant image to a location of their choosing on the system somewhere.

 

As Neil said, it takes a bit of reading to get to grips with, but if you wrote the original vba you should have little or no problems switching it over.

 

The "My First Plugin" post is a great place to start.

Message 6 of 19
MjDeck
in reply to: Gruff

Note: iLogic is an add-in and it runs in the Inventor process.  On a 64-bit system, iLogic is 64-bit.


Mike Deck
Software Developer
Autodesk, Inc.

Message 7 of 19
andrewwhiteinc
in reply to: Gruff

I ran into the same problem with crashing when we started using 64bit windows. I found that certian commands in the program need to be delayed in order for the previous command to complete (preventing the crashes). In VBA it had its own module for delays that I found on google, VB.NET call system.threading.thread.sleep(<milisecondsOfWaitTime>)

P. Andrew White, P.Eng
Manufacturing Engineering Manager
Silent-Aire Manufacturing
Message 8 of 19
Gruff
in reply to: Gruff

MjDeck,

 

Are you talking vertion 2011 or 2012?

I swear you told me in another post that iLogic was 32 bit when launched from VBA.

 

Are you suggesting I write an addin that has an interface to run external 64 bit iLogic dlls from the Addin?

 

Getting confused here.

 

Message 9 of 19
MjDeck
in reply to: Gruff

When an iLogic rule is run from VBA on a 64-bit system, it will run on a separate thread.  It's still in the 64-bit Inventor process, but it's on a separate thread: not the main thread.  Some things don't work the same on the separate thread.

 So the changed behavior is related to the fact that VBA is running in a separate 32-bit process, but technically everything in Inventor is running in 64-bit.

 If running iLogic rules is the best way to do what you're trying to do, then they should run better if you run them from an add-in, as compared to VBA.  But it might be easier to do everything you want within your add-in, without using iLogic.


Mike Deck
Software Developer
Autodesk, Inc.

Message 10 of 19
Gruff
in reply to: MjDeck

Okay.  I guess the problem with writing them as addins or combining them into one addin is develpment is slow.  My users are use to the quick turn around time afforded by developing and debugging in the field in VBA.

 

I was hoping to modularize each applet in my suite of tools such that I could recompile and disttribute the applets piecemeal. or for that matter add new applets to the suite without having to rewrite my Addin.

 

The bottom line though is that I want to eliminate all of my 64 bit issues in my custom apps so I will do whatever it takes to get there.

 

---

 

On another note.  What is the logic behind al these GUIDs in the StandardAddInServer.vb file?

 

Looking at the source for the ScreenShot Addin...

Is the Class Attribute that contains a GUID a fixed value like other Inventor API GUIDs or do I need to draw a new GUID for each Addin Class?  Does the m_ClientId GUID always match the Class GUID?

 

Further Down in the COM Registration section. do I need to draw a new GUID for the the Register and UnRegister Sub Routines for each addin or is that a fixed value?

 

Message 11 of 19
MjDeck
in reply to: Gruff

You dont need a new GUID for every class in a particular add-in.  But in a new add-in, you need a new GUID for the class that implements Inventor.ApplicationAddInServer (this class is often called StandardAddInServer).  So if you're copying and modifying Screenshot, you should change this GUID. And the ClientId should be the same as the class GUID.
 In the COM Registration section, that GUID is a fixed value defined by Inventor.


Mike Deck
Software Developer
Autodesk, Inc.

Message 12 of 19
Gruff
in reply to: MjDeck

Okay,

 

Looking over the new template I see that it pulls a new GUID for Me and that the COM Registartion is taken care of also.  Nice.

 

Regarding memory usage.  Which is better 1) Create many addins that form a suite of tools, or 2) one huge addin that contains them all?  In each Button event I will of course  be creating instances of the necessary forms and showing them.  I imagine Dot.NET garbage collection will clean up but still.....

 

 

 

Message 13 of 19
MjDeck
in reply to: Gruff

One big add-in would be more efficient.  Each add-in has overhead.  And you would probably duplicate a lot of code if you made separate add-ins.


Mike Deck
Software Developer
Autodesk, Inc.

Message 14 of 19
Gruff
in reply to: MjDeck

Thank you,

 

Will do.

 

Regarding Debugging an Addin during development.  What is the process?

Do I need to build/comile the dll and addin then copy them to their respective Inventor folders before each run?

Message 15 of 19
MjDeck
in reply to: Gruff

You shouldn't have to copy the dll.  If you're using COM registration in Inventor 2011, then Inventor can find the dll wherever it is built (and registered).
In the Debug properties for the VB project, click on Start external program: and browse to your Inventor.exe file.


Mike Deck
Software Developer
Autodesk, Inc.

Message 16 of 19
Gruff
in reply to: MjDeck

So I take it I do not need to do anything with the the addin file for debug either.  Right?

Message 17 of 19
MjDeck
in reply to: Gruff

Are you using a *.addin file?  If so, you're using registry-free COM.  That's better than using the registry, but it does require a few extra steps to debug on Inventor 2011.


Mike Deck
Software Developer
Autodesk, Inc.

Message 18 of 19
Gruff
in reply to: MjDeck

Yes indeed I am.  What would those steps be?

Message 19 of 19
MjDeck
in reply to: Gruff

 You've already copied the .addin file to %ProgramData%\Autodesk\Inventor 2011\Addins, right?

In the .addin file, you should not have any directory information for the dll. Example:
<Assembly>MyAddin.dll</Assembly>

Inventor will look for the dll in its bin directory.
In the Build properties of your VB project, set the Output path: to
C:\Program Files\Autodesk\Inventor 2011\Bin
Then Visual Studio will build your project directly into the Inventor bin folder. 


Mike Deck
Software Developer
Autodesk, Inc.

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

Post to forums  

Autodesk Design & Make Report