Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

EXPORTING PARTS LIST USING ILOGIC GETTING AN ERROR

3 REPLIES 3
Reply
Message 1 of 4
ComputerGuru666
1407 Views, 3 Replies

EXPORTING PARTS LIST USING ILOGIC GETTING AN ERROR

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
3 REPLIES 3
Message 2 of 4

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
Message 3 of 4
pecmichal
in reply to: ComputerGuru666

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

Message 4 of 4
montwa
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!!

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report