Difference between doc.SaveAs(true) and PDF.AddIn.SaveCopyAs()

Difference between doc.SaveAs(true) and PDF.AddIn.SaveCopyAs()

Anonymous
Not applicable
910 Views
2 Replies
Message 1 of 3

Difference between doc.SaveAs(true) and PDF.AddIn.SaveCopyAs()

Anonymous
Not applicable

Hi everyone,

 

I was writing an ILogic external rule which converts my IDW files to PDF.

Below is my code: 

 

SyntaxEditor Code Snippet

Dim doc As Inventor.Document
doc = ThisDoc	

Dim oPath As String = 'pathOfFile
Dim oNewName As String = 'nameOfFile
Dim oType As String = ".pdf" 'set type of document (PDF)  doc.SaveAs(oPath & oNewName & oType, True) 'save PDF in same location as file found doc.Close()    

 

As you can see in my code, I use the 'SaveAs' function with parameter as true (which makes it save copy as).

 

Now I was happy with that code, but then I saw at this link that there is another way to do it:

https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2018/ENU/Inventor-API/files/Sa...

 

In the link, they use this function 

PDFAddIn.SaveCopyAs(oDocument, oContext, oOptions, oDataMedium)

 

I'm just wondering what the differences are between the 2 functions. One thing that is worrying me is the OData medium and context ie:

ThisApplication.TransientObjects.CreateDataMedium

I do not have this in my original script, and I am wondering if it is needed.

 

Thanks for your help.

0 Likes
Accepted solutions (1)
911 Views
2 Replies
Replies (2)
Message 2 of 3

Xun.Zhang
Alumni
Alumni

Hello @YuhanZhang, would you mind shed some lights here?

Thanks!


Xun
0 Likes
Message 3 of 3

YuhanZhang
Autodesk
Autodesk
Accepted solution

Hi Victor,

  

When you convert an Inventor document to another format file, as default there would be a translator to do this. The difference between the Document.SaveAs(True) and the TranslatorAddin.SaveCopyAs is the later is professional which allow you to specify more options(just the oOptions argument does in your code). When you use the Document.SaveAs(True) and specify a different file format it will save the document to that file with default options(in UI  you can see the Options... button on the Save As dialog when you export to another file format), but while you use the  ranslatorAddin.SaveCopyAs you can override the default options if you specify different values for them.

 

 As for the oDataMedium argument, it is usually used to specify the saved file name, like you already see the PDF translator sample below:

  

https://help.autodesk.com/view/INVNTOR/2019/ENU/?guid=GUID-0712942A-A330-4779-8AAC-

2AD6BCE7245E

 

Hope this explains.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.