Inventor crashes after running code
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear Inventor Forum,
I have a Ilogic code to publish drawings. Here I can choose to make DXF file, STP file's PDF file's etc from an existing drawing. I use this in combination with a program to draw cylindrical bushings.
Now I wanted to expand this with thrust washers. The problem is, when i sellect the "publish button" the prgram crashes a certain point in the code.
I have located the line which creates the error.
It is inside an external code to create the PDF drawing.
"
If SharedVariable.Exists("PathAndName") = False Then
MessageBox.Show("SharedVariable 'PathAndName' bestaat niet, succes anyway!", "PDF Publish", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)
Exit Sub
End If
oDoc = ThisApplication.ActiveDocument
If oDoc.DocumentType <> kDrawingDocumentObject Then
MessageBox.Show("PDF kan niet gemaakt worden van een 3D", "PDF Publish", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)
Exit Sub
End If
oPDFAddIn = ThisApplication.ApplicationAddIns.ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}")
'oDocument = ThisApplication.ActiveDocument
oContext = ThisApplication.TransientObjects.CreateTranslationContext
oContext.Type = IOMechanismEnum.kFileBrowseIOMechanism
'oContext.Type = Inventor.IOMechanismEnum.kFileBrowseIOMechanism
oOptions = ThisApplication.TransientObjects.CreateNameValueMap
oDataMedium = ThisApplication.TransientObjects.CreateDataMedium
If oPDFAddIn Is Nothing Then
MessageBox.Show("Could not access PDF translator.", "PDF Publish", MessageBoxButtons.OK, MessageBoxIcon.Hand, MessageBoxDefaultButton.Button1)
Exit Sub
End If
'If oPDFAddIn.HasSaveCopyAsOptions(oDataMedium, oContext, oOptions) Then 'aangepast voor INVENTOR 2018
oOptions.Value("All_Color_AS_Black") = False 'deze werkt
oOptions.Value("Remove_Line_Weights") = False 'deze werkt
oOptions.Value("Vector_Resolution") = 600
'oOptions.Value("Sheet_Range") = PrintRangeEnum.kPrintAllSheets 'deze werkt
oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintAllSheets 'deze werkt
'oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintCurrentSheet 'deze werkt
'oOptions.Value("Sheet_Range") = Inventor.PrintRangeEnum.kPrintSheetRange 'deze werkt
'oOptions.Value("Custom_Begin_Sheet") = 1
'oOptions.Value("Custom_End_Sheet") = 100
'oOptions.Value("Display_Published_File_In_Viewer") = True 'deze werkt niet
'End If 'aangepast voor INVENTOR 2018
oDataMedium.FileName = SharedVariable("PathAndName") & ".pdf"
MessageBox.Show("Start problem")
oPDFAddIn.SaveCopyAs(oDoc, oContext, oOptions, oDataMedium)
MessageBox.Show("code run succesfully")
"
Above you see the code in question.
also you see the messagbox with "start problem" and "code run succesfully"
I have not made it to the messagebox "code run succesfully" 😆
Does anybody have an idea why the programs crashes at this line of code?