- Is there a way to check out a document when the file is open in SolidWorks? I’m trying to check out a part or assembly from an opened drawing. The highlighted line doesn’t work if the file is opened as a reference.
Sub epdmCheckOutFile(ByVal strFileName As String)
Dim folder As EdmLib.IEdmFolder5 = Nothing
Dim file As EdmLib.IEdmFile5 ' = folder.GetFile(strFileName)
file = pdmVault.GetFileFromPath(strFileName, folder)
Try
Dim RetVal As MsgBoxResult
RetVal = MsgBox("Do you want to check out " & file.Name, MsgBoxStyle.YesNo, "Vermeer Tools - Check Out File")
If RetVal = MsgBoxResult.Yes Then
file.LockFile(folder.ID, 0)
End If
Catch ex As Exception
MessageBox.Show("Unable to check out " & strFileName, "File Check Out Error", MessageBoxButtons.OK, MessageBoxIcon.Stop)
End Try
End Sub
SolidworksApi macros
I think no, because this is the system limitation. You can temporarily release the model in SolidWorks: ModelDoc2::ForceReleaseLocks, check out and then load the file into memory again: IModelDoc2::ReloadOrReplace. So no need to close the document.
______________________
Artem Taturevych
Application Engineer at Intercad
http://intercad.com.au/
Tel: +61 2 9454 4444
Artem,
Thank you, those methods helped me figure the code out.
Greg Johnson
If you have not found the solution to this Adam Hoffman has published
a sample code to handle this in this forum post. https://forum.solidworks.com/message/466424#466424
Dan Miel