User Defined Functions In Parameter Expressions

User Defined Functions In Parameter Expressions

bradeneuropeArthur
Mentor Mentor
1,837 Views
13 Replies
Message 1 of 14

User Defined Functions In Parameter Expressions

bradeneuropeArthur
Mentor
Mentor

Is this not longer supported in Inventor 2022?

bradeneuropeArthur_0-1619906865073.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
1,838 Views
13 Replies
Replies (13)
Message 2 of 14

bradeneuropeArthur
Mentor
Mentor

@johnsonshiue do you have any ideas?

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 14

WCrihfield
Mentor
Mentor

I remember seeing that documentation before, and used it in a few test/sample documents, but never used it widely or heavily.  It is referring to a very specific situation and only applies to VBA.  Basically, as it says, when you have some documents open, and you have the VBA Editor open, you will see document projects listed below the application project.  Within the 'Modules' folder under each of those document projects are two items.  One specifically called Functions, and an empty regular Module named "Module1" (by default).  Apparently the only thing the one called Functions is used for, is to let you define custom logical/mathematical functions that will be made available for use within the Equation box of the parameters in the Parameters dialog of that document.  And there doesn't seem to be a global/external 'Functions' module for an Application Project yet, that would allow shared use across multiple documents.  It's a bit restrictive, but can be useful in odd/complicated situations.

 

I'm still using Inventor Pro 2021 right now, with plans to update to 2022 very soon, but it seems like this has been there for a while now.  Just not very popular, apparently.  As far I know, the other VBA modules will continue to work as normal, but the other modules just are not exposed for use within the Equation box of the Parameters dialog, like this one is.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 4 of 14

TLoberto
Explorer
Explorer

I am also finding that this no longer works in 2022 (currently running 2022.2.1). However, I did a quick test in 2021.3.3 and found that the behavior works as expected. It would be nice to hear back from an Autodesk employee, indicating if this was intentionally removed or if there's a bug we can expect a fix for.

0 Likes
Message 5 of 14

Ralf_Krieg
Advisor
Advisor

Hello

 

Stumbled across this too in 2022.2.2

@johnsonshiue

Can Autodesk please tell if it's no longer supported or how to restore functionality?


R. Krieg
RKW Solutions
www.rkw-solutions.com
Message 6 of 14

MjDeck
Autodesk
Autodesk

Sorry about not responding sooner. This has been disabled by default in Inventor 2022 and later, but you can set an environment variable to enable it. It looks like we haven't documented this anywhere.

Create an environment variable named InventorEnableParameterMacros and set it to 1.

You can follow the steps on this page. But use InventorEnableParameterMacros for the variable name and 1 for the value. Then restart Inventor.


Mike Deck
Software Developer
Autodesk, Inc.

Message 7 of 14

MjDeck
Autodesk
Autodesk

Note that there's a separate problem with VBA parameter functions in Inventor 2022 and later. A function won't work if it has more than one argument. There is no error message, but you get the wrong result. This is issue number INVGEN-61047. We should be able to fix it soon.


Mike Deck
Software Developer
Autodesk, Inc.

Message 8 of 14

MjDeck
Autodesk
Autodesk

INVGEN-61047 was fixed in Inventor 2023.1.


Mike Deck
Software Developer
Autodesk, Inc.

0 Likes
Message 9 of 14

victoria_ulvangGXUXJ
Explorer
Explorer

Hi, I have Inventor Pro 2023.4 and VBA 7.1.

 

I'm trying to access the test function from the parameters part (.ipt). It works as expected from the macro but not from the part parameters. Tried both with prefix "VBA:" and without

Any help would be much appreciated

 
 

error.pngmacro.pngfunc.png

 

 

 

0 Likes
Message 10 of 14

Have you read this?

 

https://forums.autodesk.com/t5/inventor-programming-ilogic/user-defined-functions-in-parameter-expre...

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 11 of 14

victoria_ulvangGXUXJ
Explorer
Explorer

Yes, but as I understand error INVGEN-61047 is already fixed.

0 Likes
Message 12 of 14

MjDeck
Autodesk
Autodesk

Hi @victoria_ulvangGXUXJ , please make sure you have set the environment variable

set InventorEnableParameterMacros=1

The VBA parameter formulas won't work without that.

Also, it looks like you might have problems with the units in your expression. Often you need units conversion to get the correct results. However, the expression should be able to parse without an error as long as the units are recognized.
For more info on units, see the help.


Mike Deck
Software Developer
Autodesk, Inc.

Message 13 of 14

bill.jiang
Participant
Participant
Thank you very much
0 Likes
Message 14 of 14

bill.jiang
Participant
Participant

Another 2 issues must be careful:

1, The parmeter used in the function must be double, not single

2, If the parmeter have been used in the ilogic, the Function also will have problem.