Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.

Inventor Forum

Reply
Highlighted

EXPORTING PARTS LIST USING ILOGIC GETTING AN ERROR

1192 Views, 3 Replies
04-13-2012 10:24 AM

Using the code from the below website with a few minimal changes I am getting an error message when I try to run the iLogic rule:

http://inventortrenches.blogspot.co.uk/search/label/Autodesk%20Inventor%20iLogic?updated-max=2011-08...

 

My Code:

path_and_name = ThisDoc.PathAndFileName(False) 'without extension

'Define oDoc
oDoc = ThisDoc.Document

'Specify the drawing sheet
oSheet = oDoc.Sheets("Sheet:1") 'Sheet by name
'
oSheet = oDoc.Sheet(1) 'First Sheet

'Say There is a Partslist on the Sheet
oPartslist = oSheet.PartsLists(1)

'Create a new NameValueMap Object
oOptions = ThisApplication.TransientObjects.CreateNameValueMap

'Specify an existing template file
'
To use For Formatting Colors, Fonts, etc
oOptions.Value("Template") = "I:\INVENTOR\BOM TEMPLATE.xls"

'Specify the columns to export
oOptions.Value("ExportedColumns") = "DET. #; QTY.; DESCRIPTION; MATERIAL/VENDOR; PART NUMBER"

'Specify the start cell
oOptions.Value("StartingCell") = "A6"

'Specify the XLS Table Name
oOptions.Value("TableName") = "BOMs"

'Choose to autofit the column width in the xls file
oOptions.Value("AutoFitColumnWidth") = True

'Export the partslist to Excel with options
oPartslist.Export(path_and_name & ".xls", PartsListFileFormatEnum.kMicrosoftExcel, oOptions)

'------End of iLogic------
Error Message
 
Error in rule: Export BOM, in document: 6998-AU-3000The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))

More Info:
 System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
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)
Computer Specs:
Windows 7 (64 Bit) Pro. SP1, Inventor 2014 Pro, 3D Connexion SpaceNavigator (Driver 3.15.2)
Motherboard: ASUS Rampage IV Extreme x79 Socket 2011
Processor: Intel Core i7 Six Core Sandy Bridge-E 3.2GHz OCed to 4.7GHz (Under Water)
RAM: G.Skill Ripjaw Z-Series 32 gig quad channel of RAM 1800MHz OCed to 2133MHz
Video Card: 2x Nvidia Geforce GTX 770 (Running Six (6) Monitors)
Monitors: [Primary = 2x 24in HD WS][Secondary = 2x 22in HD WS][Tertiary = 2x 19in FS]
Primary Hard Drive: OCZ Vertex IV 256 GB Solid State Drive
Secondary Hard Drive: OCZ Vertex III 120 GB Solid State Drive

Re: EXPORTING PARTS LIST USING ILOGIC GETTING AN ERROR

04-13-2012 10:37 AM in reply to: ComputerGuru666

Never mind I figured out the issue

Computer Specs:
Windows 7 (64 Bit) Pro. SP1, Inventor 2014 Pro, 3D Connexion SpaceNavigator (Driver 3.15.2)
Motherboard: ASUS Rampage IV Extreme x79 Socket 2011
Processor: Intel Core i7 Six Core Sandy Bridge-E 3.2GHz OCed to 4.7GHz (Under Water)
RAM: G.Skill Ripjaw Z-Series 32 gig quad channel of RAM 1800MHz OCed to 2133MHz
Video Card: 2x Nvidia Geforce GTX 770 (Running Six (6) Monitors)
Monitors: [Primary = 2x 24in HD WS][Secondary = 2x 22in HD WS][Tertiary = 2x 19in FS]
Primary Hard Drive: OCZ Vertex IV 256 GB Solid State Drive
Secondary Hard Drive: OCZ Vertex III 120 GB Solid State Drive
Post 3 of 4

Re: EXPORTING PARTS LIST USING ILOGIC GETTING AN ERROR

07-04-2012 01:40 PM in reply to: ComputerGuru666

I have the same problem. How did you fixed it? Or do you make new iLogic code? 

Post 4 of 4

Re: EXPORTING PARTS LIST USING ILOGIC GETTING AN ERROR

08-14-2012 02:17 PM in reply to: ComputerGuru666

Instead of all that, just go to BOM in your .iam (assembly)

On the Assemble tab select Bill of Materials, go to parts only, (right click and enable BOM view), then click on done, 

and create a snippet, the snippet is the one at the bottom, run it and then go where you have your file .iam saved, and the excel file with the BOM exported is called "fileName"  (thats the name of the file actually!) 

 

the Snipet:

 

ThisBOM.Export("Parts Only", "fileName", kMicrosoftExcelFormat)

Cheers!!

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post

Inventor Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Autodesk Inventor helps you achieve greater speed, accuracy, and automation from concept to manufacturing.