Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
ThomasB44
in reply to: Anonymous

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 Smiley Wink

 

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
Inventor Professional EESignature