AnsweredAssumed Answered

Set variable for PDM template files in API?

Question asked by David Watkins on Sep 18, 2018

I have C# code that will run the PDM template file but our template requires the order # input to make the correct folders structure and file names. What I can't find is if there is a way to pass in a variable when running the template? I would like to do it as part of RunEx so there is not user inputs. Any ideas?


mostly from SOLIDWORKS API Help - Execute Template Example (C#)


            //Access template in the selected vault

            IEdmTemplateMgr5 templateMgr = default(IEdmTemplateMgr5);

            templateMgr = (IEdmTemplateMgr5)vaultTest.CreateUtility(EdmUtility.EdmUtil_TemplateMgr);

            IEdmPos5 pos = default(IEdmPos5);

            pos = templateMgr.GetFirstTemplatePosition();

            IEdmTemplate53 template = null;

            while (!pos.IsNull)


                template = (IEdmTemplate53)templateMgr.GetNextTemplate(pos);


                string message = template.GetMenuString();

                if (message.Contains("IPN"))


                    EdmRefreshFlag refreshFlag = default(EdmRefreshFlag);

                    object[] retData = null;

                    refreshFlag = (EdmRefreshFlag)template.RunEx(0, vaultTest.RootFolderID, out retData);