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.
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
Solved! Go to Solution.
Solved by bradeneuropeArthur. Go to Solution.
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 !
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 !
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. 🙂
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.