Share

Export to 3D PDF

Description

The 3D PDF converter is to translate Inventor model to 3D PDF format, but not like the other translators this function is implemented in an ApplicationAddin, so it is a bit different to be used via API. Below sample demonstrates how to use the ApplicationAddin.Automation to get the function to export Inventor model to 3D PDF.

Code Samples

Open a part document, and new a design view named "View1", and run below VBA code:
Public Sub PublishTo3DPDF()
    ' Get the 3D PDF Add-In.
    Dim oPDFAddIn As ApplicationAddIn
    Dim oAddin As ApplicationAddIn
    For Each oAddin In ThisApplication.ApplicationAddIns
        If oAddin.ClassIdString = "{3EE52B28-D6E0-4EA4-8AA6-C2A266DEBB88}" Then
            Set oPDFAddIn = oAddin
            Exit For
        End If
    Next
    
    If oPDFAddIn Is Nothing Then
        MsgBox "Inventor 3D PDF Addin not loaded."
        Exit Sub
    End If
    
    Dim oPDFConvertor3D
    Set oPDFConvertor3D = oPDFAddIn.Automation
    
    'Set a reference to the active document (the document to be published).
    Dim oDocument As Document
    Set oDocument = ThisApplication.ActiveDocument
    
    ' Create a NameValueMap object as Options
    Dim oOptions As NameValueMap
    Set oOptions = ThisApplication.TransientObjects.CreateNameValueMap
  
    ' Options
    oOptions.Value("FileOutputLocation") = "c:\temp\test.pdf"
    oOptions.Value("ExportAnnotations") = 1
    oOptions.Value("ExportWokFeatures") = 1
    oOptions.Value("GenerateAndAttachSTEPFile") = True
    oOptions.Value("VisualizationQuality") = kHigh
    
    ' Set the properties to export
    Dim sProps(0) As String
    sProps(0) = "{F29F85E0-4FF9-1068-AB91-08002B27B3D9}:Title"  ' Title
    
    oOptions.Value("ExportAllProperties") = False
    oOptions.Value("ExportProperties") = sProps
 
    ' Set the design views to export
    Dim sDesignViews(1) As String
    sDesignViews(0) = "Master"
    sDesignViews(1) = "View1"
    
    oOptions.Value("ExportDesignViewRepresentations") = sDesignViews
    
    'Publish document.
    Call oPDFConvertor3D.Publish(oDocument, oOptions)
End Sub


Was this information helpful?