AnsweredAssumed Answered

Add-in error when calling 'OnCmd' method

Question asked by Klaas Oudejans on Jan 15, 2013
Latest reply on Jan 21, 2013 by Klaas Oudejans

Dear readers,


I have build an add-in for our Enterprise PDM setup. We use it with Inventor. On releasing files, I want this add-in to export pdf files for all drawings in the release batch.


I got this add-in to work, but it only seems to work once. The next time I run it, I get an error stating that:


"Call to method 'OnCmd' in add-in 'ExportPFFiles', written by company 'Intralox' failed. Error cod = 0x080131603 (Unknown error 0x80131603).


But at some point, this error message will not show, and I will be able to run it once again. I don't know where or when this reset happens.


I also sometimes get an error message about the RPC server being unavailable.


I have no idea where this is going wrong, and I am hoping that somebody can point me in a direction of what can be causing these errors.


I am using Visual C#.


This is how I started my code:


using System;

using System.IO;

//using System.Windows.Forms;

using System.Collections.Generic;

using System.Text;

using EdmLib;

using Inventor;



namespace ExportPDFFiles


    public class Addin : IEdmAddIn5


        public Inventor.Application oApp;

        public Inventor.AssemblyDocument oAssyDoc;



        public void GetAddInInfo(ref EdmAddInInfo poInfo, IEdmVault5 vault, IEdmCmdMgr5 cmdMgr)


            poInfo.mbsAddInName = "ExportPDFFiles";

            poInfo.mbsCompany = "Intralox";

            poInfo.mbsDescription = "Exports all .pdf files that are related to the assembly on which this add-in is executed";

            poInfo.mlAddInVersion = 1;

            poInfo.mlRequiredVersionMajor = 5;

            poInfo.mlRequiredVersionMinor = 2;

            //This add-in is reached through a hook. Everytime a file passed to a new state, this add-in is called.





        public void OnCmd(ref EdmCmd edmCmd, ref Array data)




                if (data == null)


                //Get the current vault

                IEdmVault11 vault = (IEdmVault11)edmCmd.mpoVault;


                Boolean bFilesPDFHandled = false;



                // this doesn't do much. Everytime the sequence is here, it is called by the poststate trigger / hook

                if (edmCmd.meCmdType == EdmCmdType.EdmCmd_PostState)


               And so forth