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

Quasar_Park
Participant
Participant

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

Quasar_Park
Participant
Participant

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.

0 Likes
Reply
Accepted solutions (2)
178 Views
2 Replies
Replies (2)

vpeuvion
Advocate
Advocate
Accepted solution

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.

0 Likes

Michael.Navara
Advisor
Advisor
Accepted solution

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