AnsweredAssumed Answered

IEdmFile7::NeedsRegeneration is Broken

Question asked by Jim Sculley on Nov 5, 2015
Latest reply on Nov 6, 2015 by Jim Sculley

I have a set of files I use for EPDM API testing.  The file structure looks like this:


ABC.SLDASM (with drawing ABC.SLDDRW)

    +--A.SLDPRT (with drawing A.SLDDRW)




    +--C.SLDASM (with drawing C.SLDDRW)

        +--D.SLDPRT (with drawing D.SLDDRW)




I wrote a simple test add-in that adds a right click menu option to check the regeneration status for one or more files.  The relevant code looks like this:


private void checkRegenStatus(EdmCmd poCmd, EdmCmdData[] cmdData) 
{      foreach (EdmCmdData d in cmdData)      {         int fileID = d.mlObjectID1;          int folderID = d.mlObjectID3;          IEdmFile11 nextFile = (IEdmFile11)vault.GetObject(EdmObjectType.EdmObject_File, fileID);          IEdmFolder9 folder = (IEdmFolder9)vault.GetObject(EdmObjectType.EdmObject_Folder, folderID);          if (nextFile.NeedsRegeneration(0, folder.LocalPath));          {              MessageBox.Show("File " + nextFile.Name + "needs regeneration.");          }            if (nextFile.NeedsRegeneration(0, folderID))          {              MessageBox.Show("File " + nextFile.Name + " needs regeneration.");         }      }  } 



When I select all of my test files and run the add-in, no message boxes are displayed, which is correct since all files are up to date.


Next I open one of my test part files (say E.SLDPRT), make a change, save it and check it in.  If I now try to check out C.sldasm (or its parent ABC.SLDASM) the checkout dialog displays a warning that C.SLDASM is not rebuilt.


However, when I select all of my test files and run the add-in, no message boxes are displayed, which is incorrect since C.SLDASM require regeneration.


I have run this test on all the files in my test vault (85 files) and the only files that cause NeedsRegeneration to return a value of true are files that have not been saved in the current version of SolidWorks.  These are also the only files that cause the rebuild warning to appear in the EPDM preview window.


I've tested with both SW/EPDM 2015 SP2.1 and SW/EPDM 2016 SP0 and the results are the same.


Is anyone using IEdmFile7::NeedsRegeneration successfully? For me it appears to be horribly broken.


Jim S.