AnsweredAssumed Answered

Having trouble with GetFileCopy method

Question asked by Mike Bosscher on Jan 3, 2017
Latest reply on Jan 4, 2017 by Simon Turner

I'm working on implementing design checker as part of a workflow transition. I've gotten nearly all the bugs out, but the one outstanding issue is that the task will not update the version of the design check file (.swstd) on the task host. We're planning on increasing the number of checks we're doing over time (our users need a bit of time to adjust..), so I need to ensure that the task host has the current version of the design checker file each time it runs the task.


I'm a little surprised that the design check task doesn't already do this, but have been assured by our VAR that solidworks is aware of the issue and working towards a resolution in a later release. Unfortunately, I don't have time to wait for that release, so I'd like to add the necessary code to the task script. My understanding is that the GetFileCopy method would be appropriate, but I can't seem to figure out how it works. Can someone step me through how to use it in VBA?


What I've got to date looks something like this;




Call LoginToVault (this is found in the default design checker task script, the following is what I've added, based on a couple examples I found here in the forum, and the API help files)


Call GetFileCopy(Me.Handle.ToInt32(),0,0,EdmGetFlag.EdmGet_Simple,"")




Private Sub GetFileCopy( _
Dim lParentWnd As System.Integer, _
Dim poVersionNoOrRevisionName As System.Object, _
Dim poPathOrFolderID As System.Object, _
Dim lEdmGetFlags As System.Integer, _
Dim bsNewName As System.String _

Dim SWSTDFolder as IEdmFolder5
Dim GetSWSTD as IEdmFile5

set SWSTDFolder = vault.GetFolderFromPath("C:\Vault_Sandbox\Tigercat\Support\SolidWorks\2015\DesignCheckerFiles")
GetSWSTD = SWSTDFolder.GetFile("Released.swstd")

End Sub


Any suggestions would be appreciated.