Inventor 2023 VBA changes and errors
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi All,
Just moved over to Inventor 2023 from 2021 and there are a number of VBA functions that don't seem to be working any longer. I'll try to include enough code to be self explanatory to get the point across. The purpose of this thread is to discuss the bugs and try to get to the bottom of what is intentional and what needs to be escalated. And FYI, I've been doing this kind of coding on and off since 2016 (the year not necessarily the Inventor version).
Starting with an easy one:
Dim apprentice As New Inventor.ApprenticeServerComponent
Dim apprenticeDoc As Inventor.ApprenticeServerDocument
If Right(NameAndPath, 4) = ".iam" Then
Set apprenticeDoc = apprentice.Open(NameAndPath & "<All Components Suppressed>")
Level of Detail (LOD) has been removed so this bug was expected. An easy fix is to edit the code to not include & "<All Components Suppressed>" but then, is there an alternative approach to opening assemblies in a 'light' way?
A bigger issue that I'm facing and having trouble resolving is the SaveAs or Translator methods for generating export files, namely DXF, IGS & STP. Though PDF was successful. Example using the SaveAs method:
Dim oApp As Inventor.Application
Dim oDoc As Inventor.Document
Set oApp = CreateObject("Inventor.Application")
oApp.SilentOperation = True
Set oDoc = oApp.Documents.Open(PartNameandFilePath, False)
IgsNameandPath = [Some directory] & Worksheets("FileSet").Range("A8").Offset(Row, 0) & ".igs"
Call oDoc.SaveAs(IgsNameandPath, True)
I have tried using the Translator example code from Autodesk which fails on the last line:
Call DXFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)