10-10-2017
05:16 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
10-10-2017
05:16 AM
Hi @Anonymous
When you say "after the last PDF created", do you mean that the PDF from the top level drawing was created ?
The error you have is : "Inventor.Documents.Open(String FullDocumentName, Boolean OpenVisible)"
So the problem IMO is this line : ( - - - - after Top level drawing - - - - )
oAsmDrawingDoc = ThisApplication.Documents.Open(ThisDoc.ChangeExtension(".idw"), True)
Which could run this issue :
- if the drawing does not exist at the same path than the assembly
- if the drawing name is not the same than the assembly
- if the drawing extension is not *.idw
Please check this ![]()
You can also try to modify the code like this to avoid the error :
'- - - - - - - - - - - - -Top Level Drawing - - - - - - - - - - - -
Dim oAsmDrawingDoc As DrawingDocument
oAsmDrawingDocName = ThisDoc.PathAndFileName(False) & ".idw"
If(System.IO.File.Exists(oAsmDrawingDocName)) Then
'oAsmDrawingDoc = ThisApplication.Documents.Open(ThisDoc.ChangeExtension(".idw"), True)
oAsmDrawingDoc = ThisApplication.Documents.Open(oAsmDrawingDocName, True)
oAsmDrawingName = Left(oAsmDrawingDoc.DisplayName, Len(oAsmDrawingDoc.DisplayName) -3)
On Error Resume Next
oDataMedium.FileName = oFolder & "\" & oAsmDrawingName & "pdf"
Call PDFAddIn.SaveCopyAs(oAsmDrawingDoc, oContext, oOptions, oDataMedium)
oAsmDrawingDoc.Close
End If
Thomas
Mechanical Designer / Inventor Professionnal 2025