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: 

Calling VBA from iLogic speed

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
bcoburn3
2026 Views, 5 Replies

Calling VBA from iLogic speed

I have a one line iLogic rule:

 

InventorVb.RunMacro("CVDMacros", "ProductionMacros", "OnSavePart")

that just calls a VBA macro that checks that the part number and description are not too long for our MRP system.

 

This takes about 10seconds to run, even if I make the VBA macro just assign a temporary variable and nothing else.  Is there anything  I can do to make calling a VBA macro from iLogic faster?

5 REPLIES 5
Message 2 of 6
00ash00
in reply to: bcoburn3

If you watch the bottom left hand corner of screen each time you run your rule, you will notice inventor loading VBA, in the option menu you can tell inventor to load VBA @ startup but it makes no difference. I have converted all of my macro's to iLogic or to a standalone VB.Net programme, upto 10 times faster
Ash

Dell - T1650
Intel(R)Xeon(R) CPU E3-1290 V2 @ 3.70GHz
16GB
64-Bit
Windows 7 Pro
Inventor 2013 Build: 138
Message 3 of 6
bcoburn3
in reply to: 00ash00

Is there an easy way to both make sure that all the engineers here have an iLogic rule and update it seperately template files?

 

The thing I like about my current setup is that if next week I want to change the code that triggers on save I can just edit the .ivb macro file, and all the parts made between then and now will automatically get the changes.  I'd be happy to rewrite everything as an iLogic rule, but I don't know how to get that updating effect with iLogic.

Message 4 of 6
Vladimir.Ananyev
in reply to: bcoburn3

You may consider to use external iLogic rules that are stored in the text files on server.  In this case you don't have to involve VBA environment that should improve overall performance.   Another option is to call external functions from DLL directly from iLogic rules triggered by events.


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 5 of 6
ekinsb
in reply to: bcoburn3

I didn't test this but here is an educated guess.

 

I assume you're running 64-bit Inventor.  VBA was only available as a 32-bit application and to allow it to work with 64-bit Inventor is being run in a seperate external process.  If you were running 32-bit Inventor then the performance will probably be ok.  Also, Microsoft has recently made 64-bit VBA available and this is what's used for Inventor 2014, so I'm guessing that the performance will be ok with Inventor 2014.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 6 of 6
bcoburn3
in reply to: ekinsb

An external iLogic rule is probably the correct fix to my problem, but it turns out that just taking the VBA file and re-arranging things so that the macros triggered on save where in their own small module made everything fast enough that it's no longer a problem.  This did  break everyone's keyboard/ribbon shortcuts to the macros, is there a reasonable way to change which module a particular macro is in without breaking keyboard shortcuts?

 

I think the issue was that Inventor was loading/maybe compiling the entire project file every time the trigger ran, which takes however many seconds.  What would be ideal in some future version would be a way to get it to only do that once on startup, similar to the "Load VBA on Startup" option in the general tab of the application options, which seems to work only for VBA things that aren't called from iLogic.

 

Ben Coburn

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

Post to forums  

Autodesk Design & Make Report