By Clint Brown
If you've been looking to export a 3D PDF out of Inventor using iLogic, then look no further. I've based my iLogic code on the Inventor API sample for 3D PDF export, with a few tweaks to make it user friendly.
I must warn you that this is SLOW, and that there is no progress bar, so you may be waiting around a while if you try to publish anything big. My suggestion is to test it on some smaller components, to get a feel for the performance. When publishing 3D PDF's from Inventor's interface you get a bit more feedback and a progress bar which is quite helpful.
One accidental discovery is that we are not selecting a template in the export options, so the PDF that is published is nice an clean, as per the image below. This is shown in Adobe Acrobat Reader DC, as this is the only reader that supports 3D PDF's
I've added a few little tweaks along the way, like a popup, to ask the user if they really want to publish a 3D PDF and a warning that it could take some time, based on the model complexity and the accuracy of the model.
I've also added a popup based on an array list to select a PDF accuracy, with a default setting to "Low" if the user ignores this pop-up box. See the 2 examples below, one published as "High Accuracy" and one as "Low Accuracy". The images below show the tessellation that can occur on "Low Accuracy" exports.
I found that there was a minor typo in the API example, this was related to the options for Visualisation Quality.
This line in the code: oOptions.Value("VisualizationQuality") = kHigh,
This should read : oOptions.Value("VisualizationQuality") = AccuracyEnum.kHigh
Once the user has set the quality that they wish to use, the 3D PDF is generated in the background. At this point I have added some status bar text that lets the user know that this could take a while, based on model complexity, PDF quality etc. and once the process is complete, this status changes to "Your 3D PDF is ready" and the user is promoted to open the PDF with a little message box.
I hope you find this useful. The code is attached in the 3D PDF.txt file.