Layers in PDF disappearing seemingly random when using PDF translator

Layers in PDF disappearing seemingly random when using PDF translator

Anonymous
Not applicable
944 Views
5 Replies
Message 1 of 6

Layers in PDF disappearing seemingly random when using PDF translator

Anonymous
Not applicable

Hi,

 

I'm having an issue with using the PDF translator in Inventor 2015.

 

I'm using the below code to export PDF files of fabrication/assembly drawings.

 

 TranslatorAddIn oTranslator = (TranslatorAddIn)m_InventorApp.ApplicationAddIns.get_ItemById("{0AC6FD96-2F4D-42CE-8BE0-8AEA580399E4}");
            if (oTranslator != null)
            {
                TransientObjects oTranslatorObjects = m_InventorApp.TransientObjects;
                TranslationContext oTranslatorContext = oTranslatorObjects.CreateTranslationContext();
                //These are the options used for exporting PDF. 
                NameValueMap oTranslatorNameValueMap = oTranslatorObjects.CreateNameValueMap();
                DataMedium oDataMedium = oTranslatorObjects.CreateDataMedium();
                //Here we set the options. 
                oTranslatorNameValueMap.set_Value("Sheet_Range", PrintRangeEnum.kPrintAllSheets);
                //These are additional options. 
                oTranslatorNameValueMap.set_Value("Remove_Line_Weight", false);
                oTranslatorNameValueMap.set_Value("Vector_Resolution", 720);
                oTranslatorContext.Type = IOMechanismEnum.kFileBrowseIOMechanism;
                foreach (var workingFile in m_workingFiles)
                {
                    try
                    {
                        var openedDoc = m_InventorApp.Documents.Open(workingFile.SourceFilePath, true);
                        openedDoc.Update2(true);
                        if (openedDoc != null)
                        {
                            //oDataMedium.FileName = workingFile.OutputFilePath;
                            oDataMedium.FileName = workingFile.TempOutputFilePath;
                            oTranslator.SaveCopyAs(m_InventorApp.ActiveDocument, oTranslatorContext, oTranslatorNameValueMap, oDataMedium);
                            Logger.LogDebug("I've created PDF file " + workingFile.TempOutputFilePath);

 

Sometimes it gives proper results (rev01 attached) and sometimes it doesn't (rev02 attached). The difference I can see in the PDF is in the layers; Sometimes it doesn't export the Visible Narrow layer.

 

missing_layer.png

 

Does anybody know what's driving this difference? Or a workaround to how we could avoid it?

 

Thank you very much in advance.

 

/Klaas

0 Likes
945 Views
5 Replies
Replies (5)
Message 2 of 6

Anonymous
Not applicable

No one is familiar with this issue? Or is there some more information I can include?

0 Likes
Message 3 of 6

Anonymous
Not applicable

After developping a similar Addin to export assembly sheets to PDFs, I found out that the PDF translator was not consitent with its results. What content is in the layer that is not always exported? Have you tried to export the PDFs using a PDF printer, it was a consistent method in my case.

0 Likes
Message 4 of 6

Anonymous
Not applicable

Thanks for you answer! I was not able to discover a pattern in the behavior. Somewhere I suspect it has something to do with Inventor not being fully ready with displaying the drawing before the export command is given.

But when it happens, typically the Visible Narrow layer is not in the outputted pdf file, but...the content of the remaining layers is also not correct.

 

I saw for example that my layer Title (ISO) holds the title block in the correct export, but in the faulty export this layer holds the title block and some additional geometry that should have been captured in separate layers and looks like they're all "referenced" parts. faulty_layer.png

 

Your tip about printing to PDF is good, and I have been evaluating that. Before I go down that road, I would really like to know indefinitely that Inventor 2015 is not able to properly export PDF's, because it would be so much easier if it just worked like it was supposed to..

 

Thanks!

 

Message 5 of 6

Anonymous
Not applicable

Have you try to call the make precise method from the drawing document before exporting?

 

2016-07-12_09-03-05.png

 

As for the PDF print option, the only problem with this method is that you can't have specific settings for each page you are exporting. You can only set the orientation, paper size, etc... for the whole PDF you are exporting, which can be a problem depending on what you are doing.

 

Good luck 🙂 

0 Likes
Message 6 of 6

Anonymous
Not applicable

This is very interesting, I will definitely give this a try. When I set a view to "raster" type and zoom in and out it looks like for a minute it's thinking about how to paint the view and in that moment it looks like the messed up lines I see when exporting it.

 

I also see this comment in the help :

 

If the Enable Background Updates application option is selected, raster views are displayed until calculation of precise views is complete. For more information, see Work with raster views.

 

 

 

So my first hunch is to disable background updates. Trying to figure out what that does;

 

Capacity/Performance Enable background updates

Switches the display of raster drawing views on or off.

Raster views increase your productivity when you work with drawings created for large assemblies. You can review a drawing or create drawing annotations before precise calculation of drawing views finishes. Precise drawing views are calculated in the background while you work with raster views.

 

 

Does this mean that it will always force precise views before the drawings become editable?

 

Thanks, I have hope again!!!

 

 

0 Likes