Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Stansteel
695 Views, 2 Replies

Need help with iLogic code - Throws error

Hello,

 

I have managed to put together an iLogic code by copying and pasting several snippets from this community (Thank you).  This code is meant to do the following in this order: 1) Run an external rule (Renaming all drawing sheet names); 2) Prompt for "Release Folder" Location; 3) Create folder "BOM"; 4) Export Parts List of active sheet (should always be the first sheet) to an Excel spreadsheet using a template with options; 5) Create folder "PDF"; 6) Export all sheets to PDF; 7) Create folder "DWG"; 8) Export all sheets to DWG.

 

Here's the issue.  I developed this code last week and had it working well on Friday.  Today it's throwing an error: 

 

Error Message Tab:

Error in rule: Release All Exports - Drawing, in document: S450-BW-DB-A1.idw

The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

 

More Info Tab:

System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn)
at LmiRuleScript.Main()
at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

Would someone be willing to dissect my code and figure out what's wrong?  Why would it work one day, but not the next?  To my knowledge nothing has changed since it was working on Friday.

 

FYI - I've split the code up and think I've narrowed it down to the problem being in the Parts List Export section.

 

Also - I'm not much of a programmer.  If you can or would like to re-write this code to make it more stable, that would be great.

 

Thank you in advance for any kind of help you can provide.

 

Nate

Hi Stansteel,

 

Does the Parts List have all of the columns listed ? exactly as they are written:

 

oOptionsBOM.Value("ExportedColumns") = "ITEM#;QTY;PART#;MATERIAL;DESCRIPTION;COMMENTS;COM CODE;TOTAL WEIGHT"

 

You might pare that down to just two columns, as a test. Example:

 

oOptionsBOM.Value("ExportedColumns") = "ITEM#;QTY"

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

That was right on Curtis.  I must have written this code while looking at an old drawing which had the TOTAL WEIGHT column spelled out.  My new drawings have it abbreviated to "TOTAL WT.".  Simple.  Thank you for helping me trouble shoot.

 

Nate