Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

iParts not exporting to Excel... but iAssy works

4 REPLIES 4
SOLVED
Reply
Message 1 of 5
danny.lewisA9QBW
436 Views, 4 Replies

iParts not exporting to Excel... but iAssy works

So I can't figure why the command is working or assembly iAssy but not for the part iPart. Below is the chunk of code to run them. I've attached example files I was using.

Error Messages1.JPGError Messages2.JPG

Dim Path As String = "C:\TEST\ExportTest"
Dim ExportFile As String = Path & ".xls"

Logger.Info("ExportFile " & ExportFile)
Dim oDoc As Document = ThisDoc.Document

If oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
Logger.Info("Assy FileType")	
	Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument


	If oAsmDoc.ComponentDefinition.IsiAssemblyFactory = True Then
		Logger.Info("Assy iAssemblyFactory Found")
		Dim oiAssyFactory As iAssemblyFactory = oAsmDoc.ComponentDefinition.iAssemblyFactory
		oiAssyFactory.Export(ExportFile, FileFormatEnum.kMicrosoftExcelFormat)
	End If
End If

If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
Logger.Info("Part FileType")
	Dim oPartDoc As PartDocument = ThisApplication.ActiveDocument
Logger.Info("oPartDoc")
	If oPartDoc.ComponentDefinition.IsiPartFactory = True Then		
		Logger.Info("Part iPartFactory Found")
		Dim oiPartFactory As iPartFactory = oPartDoc.ComponentDefinition.iPartFactory
		oiPartFactory.Export(ExportFile, FileFormatEnum.kMicrosoftExcelFormat)
	End If
End If

 

 

Labels (4)
4 REPLIES 4
Message 2 of 5

Dim Path As String = "C:\TEST\ExportTest"
Dim ExportFile As String = Path & ".xlsx"

Logger.Info("ExportFile " & ExportFile)
Dim oDoc As Document = ThisDoc.Document

If oDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
Logger.Info("Assy FileType")	
	Dim oAsmDoc As AssemblyDocument = ThisApplication.ActiveDocument


	If oAsmDoc.ComponentDefinition.IsiAssemblyFactory = True Then
		Logger.Info("Assy iAssemblyFactory Found")
		Dim oiAssyFactory As iAssemblyFactory = oAsmDoc.ComponentDefinition.iAssemblyFactory
		oiAssyFactory.Export(ExportFile, FileFormatEnum.kMicrosoftExcelFormat)
	End If
End If

If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
Logger.Info("Part FileType")
	Dim oPartDoc As PartDocument = ThisApplication.ActiveDocument
Logger.Info("oPartDoc")
	If oPartDoc.ComponentDefinition.IsiPartFactory = True Then		
		Logger.Info("Part iPartFactory Found")
		Dim oiPartFactory As iPartFactory = oPartDoc.ComponentDefinition.iPartFactory
		oiPartFactory.Export(ExportFile, FileFormatEnum.kMicrosoftExcelFormat)
	End If
End If

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

Message 3 of 5

use "xlsx" instead of "xls"

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

Message 4 of 5

@bradeneuropeArthur 

 

so that works.... but WTF...

 

why is it .xls for Assemblies (and .xlsx doesn't work) and .xlsx for Parts (And .xls doesn't work)?

 

Regardless the why... it's working; I'll take it. 🙂

Message 5 of 5

That is indeed strange!

@johnsonshiue Do you have any idea why that is the case!

Regards,

Arthur Knoors

Autodesk Affiliations:

Autodesk Software:Inventor Professional 2024 | Vault Professional 2022 | Autocad Mechanical 2022
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:Drawing List!|Toggle Drawing Sheet!|Workplane Resize!|Drawing View Locker!|Multi Sheet to Mono Sheet!|Drawing Weld Symbols!|Drawing View Label Align!|Open From Balloon!|Model State Lock!
Posts and Ideas:Dimension Component!|Partlist Export!|Derive I-properties!|Vault Prompts Via API!|Vault Handbook/Manual!|Drawing Toggle Sheets!|Vault Defer Update!


! For administrative reasons, please mark a "Solution as solved" when the issue is solved !

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

Post to forums  

Autodesk Design & Make Report