Quantcast
Channel: Manufacturing DevBlog
Viewing all articles
Browse latest Browse all 518

Sorting “invalid arguments” error in C# add in code for generating 3D PDF in Inventor

$
0
0

The VB.NET add-in for 3D PDF generation works well and directly without issues. However, the C# API code throws an invalid arguments error at the Publish() method. This is because the code uses late binding.  This blog contains steps on how to resolve this error


Step 1:
As mentioned in this blog (here) set the Embed Interop Type to False under the Inventor Interop Assembly reference

Embed

Step 2:
Add the Microsoft.CSharp reference to your project then import the namespace in the code

Reference

 

Step 3:
Declare the PDF converter 3D ApplicationAddin Variable as dynamic as seen below
dynamic oPDFConvertor3D ;
oPDFConvertor3D = oPDFAddIn.Automation;

Step 4:
The Publish() method takes two arguments, the first is of type Inventor document and the second is of Inventor NameValueMap type. Declare the variable of the type document as dynamic before parsing it to the method.

See the sample code below


dynamic oDocument;
oDocument = m_inventorApplication.ActiveDocument;

These steps should be able to resolve the error.

- Fidel


Viewing all articles
Browse latest Browse all 518

Trending Articles