3D PDF

3D PDF

manasi_patilESZTV
Contributor Contributor
685 Views
6 Replies
Message 1 of 7

3D PDF

manasi_patilESZTV
Contributor
Contributor

I try to convert .iam file to 3D pdf using Inventor programing Api help but it is not Coverting.

0 Likes
686 Views
6 Replies
Replies (6)
Message 2 of 7

Michael.Navara
Advisor
Advisor

Can you put your code sample and test date here? Without this information we can't help you.

0 Likes
Message 3 of 7

manasi_patilESZTV
Contributor
Contributor

the Error is :'Typelib export: Type library is not registered. (Exception from HRESULT: 0x80131165)' In below code at line no 36  pdfConvertor3d.Publish(oDoc, oOptions);

public void Export3DPdf()
        {
            Inventor.Application InvApp = mApp;

            Inventor.ApplicationAddIn  PDFAddin = null ;

            foreach (ApplicationAddIn appAddin in mApp.ApplicationAddIns )
            {
                if (appAddin.ClassIdString == "{3EE52B28-D6E0-4EA4-8AA6-C2A266DEBB88}")
                {
                    PDFAddin =  appAddin;
                    break;
                }
            }

            dynamic pdfConvertor3d = PDFAddin.Automation;

            Document oDoc = mApp.ActiveDocument;
            // Create a NameValueMap object
            Inventor.NameValueMap oOptions = InvApp.TransientObjects.CreateNameValueMap();
            
            oOptions.Value["FileOutputLocation"] = @"c:\temp\3DPDF.pdf";
            oOptions.Value["ExportAllProperties"] = true;
            oOptions.Value["GenerateAndAttachSTEPFile"] = true ;
            oOptions.Value["ExportTemplate"] = @"C:\Users\Public\Documents\Autodesk\Inventor 2019\Templates\Sample Part Template.pdf";
            oOptions.Value["VisualizationQuality"] = AccuracyEnum.kHigh;

            //string[] sProps = new string[1];
            //sProps[0] = "{F29F85E0-4FF9-1068-AB91-08002B27B3D9}:Title";
            //oOptions.Value["ExportAllProperties"] = false; 
            //oOptions.Value["ExportProperties"] = sProps;

            String[] sDesignViews = new string[] { "Master", "View1" }; 
            oOptions.Value["ExportDesignViewRepresentations"] = sDesignViews;

            pdfConvertor3d.Publish(oDoc, oOptions);

        }

 

0 Likes
Message 4 of 7

manasi_patilESZTV
Contributor
Contributor

Get Error while converting

0 Likes
Message 5 of 7

Michael.Navara
Advisor
Advisor

I tested your code, and the issue is in type of variable oDoc. This variable MUST be of type _Document instead of Document.

Document oDoc = mApp.ActiveDocument; //DOESN'T WORK
_Document oDoc = mApp.ActiveDocument;

 

0 Likes
Message 6 of 7

manasi_patilESZTV
Contributor
Contributor

I try for this code but still give same error.

_Document oDoc = mApp.ActiveDocument;

 

0 Likes
Message 7 of 7

StKrause
Contributor
Contributor

@manasi_patilESZTV check if template

C:\Users\Public\Documents\Autodesk\Inventor 2019\Templates\Sample Part Template.pdf

exists and designView "View1" exists in your assembly (lines 25 and 33 in your code).

0 Likes