0 Replies Latest reply on Sep 18, 2018 11:12 AM by David Watkins

    Set variable for PDM template files in API?

    David Watkins

      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 http://help.solidworks.com/2017/english/api/epdmapi/Execute_Template_Example_CSharp.htm2017 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);