By Clint Brown
Following on from my blog Inventor 2016 - iLogic - Create Custom iProperty on the fly. I thought I would share a method for creating Parameters on the fly.
I've written 2 sets of code, one creates a parameter based on an Integer (mm) and the second based on a String, or text parameter. Both sets of code are designed to run on part files only.
The code allows you to create a Custom Parameter and give it a value on the fly.
The 2 different sets of code are attached to this blog post as a txt file.
The animated GIF below shows the code in action, in this instance the millimeter or Integer code (Click to Zoom)
Some Kudos must go to Luke Davenport for his blog Exit Rule Based on File Type which I borrowed a bit of code from for this.
- Parameter on the fly - INTEGER.txt992 Bytes
- Parameter on the fly - TEXT.txt988 Bytes
Comments
1 comment
Hi, I've just used your integer rule as a basis for a rule I've written, sometimes it works and sometimes it returns the following error (see below)
did you come across this problem with any of your part files / can you suggest a reason why the code would work in one part file and not another. Many Thanks!
Error in rule: Add Area Parameter, in document: 1805 11 dwrside LH.ipt
Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
and under more info:
System.Runtime.InteropServices.COMException (0x80020003): Member not found. (Exception from HRESULT: 0x80020003 (DISP_E_MEMBERNOTFOUND))
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)
Please sign in to leave a comment.