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: 

The i-logic, which was running without errors in the inventer 2014 version, will fail in the 2021 version. Please help me.

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
Quasar_Park
150 Views, 2 Replies

The i-logic, which was running without errors in the inventer 2014 version, will fail in the 2021 version. Please help me.

Hello, I am asking questions through a translator.

 

Among the three attached files, I used the i-Logic called pdf2014 well in the inventer 2014 version, but when I upgraded the inventer to the 2021 version and tried to use pdf2014, an error occurred
So even though I wrote a modified i_logic called pdf2021, I still get an error in the pdf_error_message file.
What should I modify in pdf2021 to solve it?
The product build is 421 and the release is 2021.5.2.

2 REPLIES 2
Message 2 of 3
vpeuvion
in reply to: Quasar_Park

Hi,

I have the impression that your code was written twice, the error message comes from the fact that you used variables in a first part of the code and that you declared them in a second part. You must first declare the variable and then use it.

First part : 

vpeuvion_0-1700553889394.png

Second part :

vpeuvion_1-1700553905077.png

Example : 

First: Dim oContext as translationContext
Then: oContext = ThisApplication...

Hope this will help you.

Vincent.

Message 3 of 3

As @vpeuvion mentioned above, it is recommended to use Dim before you declare variable. But the issue is in different line. The call for HasSaveCopyAs is different. You need to pass Document instead of DataMedium as the first argument. See line 18 below.

 

            '------start of iLogic-------
            Dim oPath = "C:\Temp\DWG EXPORT" ' "D:\DWG EXPORT"
            Dim oFileName = ThisDoc.FileName(False) 'without extension
            Dim oPDFAddIn As TranslatorAddIn = ThisApplication.ApplicationAddIns.ItemById _
                       ("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
            Dim oDocument = ThisApplication.ActiveDocument
            Dim oContext = ThisApplication.TransientObjects.CreateTranslationContext
            oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
            Dim oOptions = ThisApplication.TransientObjects.CreateNameValueMap
            Dim oDataMedium = ThisApplication.TransientObjects.CreateDataMedium

            'Define the drawing 
            Dim oDrawing As DrawingDocument
            oDrawing = ThisDoc.Document

            'set PDF Options
            'If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then
            If oPDFAddIn.HasSaveCopyAsOptions(oDocument, oContext, oOptions) Then

 

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

Post to forums  

Autodesk Design & Make Report