creating 3d pdf with API and C#.NET

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
our company has just updated to Inventor 2017 to export some Assembly/Part to 3D PDF.
Now we are now trying to integrate the 3D PDF export in a own developed software with c#.net.
But we have encountered a minor problem and we need support from developpers.
In the help file of the api in Inventor 2017 there is a api sample for “Export to 3D PDF API Sample” in VBA (see below in green)
When trying the same in C#.NET we have the problem that following code will not compile.
The pdfConvertor3d.Publish will not work because of the definition of pdfConvertor3d as object.
What class/interface should we cast TranslatorAddIn.Automation!
Do you have a sample code in C#.NET for the export of 3d pdf like below?
TranslatorAddIn pdf3dAddIn = (TranslatorAddIn)iApp.ApplicationAddIns.ItemById["{3EE52B28-D6E0-4EA4-8AA6-C2A266DEBB88}"];
object pdfConvertor3d = pdf3dAddIn.Automation; //pdf3dAddIn.Automation returns an object or what class should we cast it?
//…
//Publish document
pdfConvertor3d.Publish(idoc, oOptions); //Publish is not valid!
Export to 3D PDF API Sample (VBA) of the API Help
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
Regards
Enzo Naso