Inventor Drawing - Trying to read from embedded excel file using iLogic

Inventor Drawing - Trying to read from embedded excel file using iLogic

house_exodus
Explorer Explorer
1,006 Views
3 Replies
Message 1 of 4

Inventor Drawing - Trying to read from embedded excel file using iLogic

house_exodus
Explorer
Explorer

So, I've been at work trying to get templates updated/made for my company, and one of the big things is to build an  .Idw template. One of the primary goals is to get this drawing template to function similar to an AutoCAD equivalent my company currently has in use. That being said, the AutoCAD version has a huge number of drop-down fields for various codes that corporate uses.

I get that I could manually type all 3000+ codes into multi value fields via the drawing's parameters; however i feel it would be much easier and cleaner if I could just use an excel document to run them from instead. I'm adamant about embedding the document however, since losing the link to a non-embedded file is a major concern.

Thus far, every time I have setup code to read from an embedded file, and have the text output to a parameter, it has failed. Yet if I use a non-embedded file, it works just fine. The error I keep receiving is
"Object reference not set to an instance of an object."

I've heard rumors that iLogic can't run from inserted object-based documents, yet idw/dwgs won't let you link a file in the parameters window for reasons I fail to understand.


Any ideas on how to solve this?

0 Likes
1,007 Views
3 Replies
Replies (3)
Message 2 of 4

jhackney1972
Consultant
Consultant

Take a look at this Autodesk Knowledge Document.

John Hackney, Retired
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

Message 3 of 4

Codered741
Contributor
Contributor

Post the code you have, so we can take a look. 

 

The error you are getting has several reasons that it may appear.  Most commonly it occurs when you try to assign data of one type, to a variable declared as an incompatible type. 

0 Likes
Message 4 of 4

house_exodus
Explorer
Explorer

The Code I've been using isn't really anything special, and that's why I am wondering if perhaps I do need to add more to it. Currently it's just the standard:

 

MultiValue.List("BLD_List") = GoExcel.CellValues("3rd Party:Embedding 1", "Sheet1", "A3", "A50")


The exact error message info I get reads:
System.NullReferenceException: Object reference not set to an instance of an object.
   at iLogic.GoExcel.ThirdPartyFindWorkSheet(String thirdName, String sheetName)
   at iLogic.GoExcel.SetCurrentSheet(String fileName, String sheetName)
   at iLogic.GoExcel.EstablishBoundaryCells(String fileName, String sheetName, String startCellAddress, String endCellAddress)
   at iLogic.GoExcel.get_CellValues(String fileName, String sheetName, String startCellAddress, String endCellAddress)
   at LmiRuleScript.Main()
   at Autodesk.iLogic.Exec.AppDomExec.ExecRuleInAssembly(Assembly assem)
   at iLogic.RuleEvalContainer.ExecRuleEval(String execRule)

 

"BLD_List" is the parameter I'm trying to populate from the embedded excel document, so essentially it will act as a drop down that the user selects during drawing creation. The whole idea is, assuming I can get the embedded sheet to read, that the BLD_List will = different columns "B3-50, C3-50, etc." all based on the users location choice during drawing creation. (BLD_List = building list which is based specific to location codes our company uses.) I know I can hard-code all of this data in the multi-value list itself, however having it in an excel format makes it much easier to edit, and our company currently has something like 2-3K building codes alone, hence why I've been aiming for this approach.


Additionally, if I switch the code to read from an external Excel sheet it works fine

"MultiValue.List("BLD_List") = GoExcel.CellValues("C:\Users\Desktop\Inventor - Active\Book1.xls", "Sheet1", "A1", "A50")"

 

0 Likes