Hi Everyone,
I am trying to open a catia product and a catia drawing as read only from smarteam, using VB. I have looked in the smarteam documentation and it really hasn't helped me a whole lot. (I haven't written any VB stuff yet for Smarteam, just for CATIA)
If anyone can tell me the code to do this, I would really appreciate it.
Thanks,
Angie
If it helps any, this is what I tried...
Dim WorkObject As SmApplic.ISmObject
Dim FileName As String 'destination file name
Dim Directory As String 'destination directory
Dim FileMode As Integer 'mode of copied file (read only ,read & write ...)
' Set parameters for operation
FileMode = modReadOnly
Directory = "C:\"
FileName = WorkObject.Data.ValueAsString(NM_FILE_NAME)'Here's where it stops
' Copies file from vault - read only access
WorkObject.CopyFileFromVaultPermission FileName, Directory, FileMode
It seems I setting the filename wrong, maybe putting the wrong thing as NM_FILE_NAME.
Hope someone can help me!!
Angie
Now I tried..
Dim PrmId As SmRecList.SmRecord
Dim CatProdClass As SmApplic.ISmClass
Dim CatProdObj As SmApplic.ISmObject
Dim SessionUtil As SmUtil.SmSessionUtil
Dim RetrievedObject As SmApplic.ISmObject
Dim Revision As String
Set PrmId = New SmRecList.SmRecord
PrmId.AddHeader "TDM_ID", 40, sdtChar
PrmId.AddHeader "REVISION", 40, sdtChar
PrmId.Value("TDM_ID") = "CATPRD-0515"
' PrmId.Value("REVISION") = "a.7"
Set CatProdClass = SmSession.MetaInfo.SmClassByName("CATIA Product")
Set CatProdObj = SmSession.ObjectStore.RetrieveObjectByPrimaryIdentity(CatPro dClass.ClassId, PrmId)
It all works except is sets CatProdObj to Nothing, so I can't copy the file to another directory, (which is what I think I need to do to access it)
Edited by: angiep
I am trying to open a catia product and a catia drawing as read only from smarteam, using VB. I have looked in the smarteam documentation and it really hasn't helped me a whole lot. (I haven't written any VB stuff yet for Smarteam, just for CATIA)
If anyone can tell me the code to do this, I would really appreciate it.
Thanks,
Angie
If it helps any, this is what I tried...
Dim WorkObject As SmApplic.ISmObject
Dim FileName As String 'destination file name
Dim Directory As String 'destination directory
Dim FileMode As Integer 'mode of copied file (read only ,read & write ...)
' Set parameters for operation
FileMode = modReadOnly
Directory = "C:\"
FileName = WorkObject.Data.ValueAsString(NM_FILE_NAME)'Here's where it stops
' Copies file from vault - read only access
WorkObject.CopyFileFromVaultPermission FileName, Directory, FileMode
It seems I setting the filename wrong, maybe putting the wrong thing as NM_FILE_NAME.
Hope someone can help me!!
Angie
Now I tried..
Dim PrmId As SmRecList.SmRecord
Dim CatProdClass As SmApplic.ISmClass
Dim CatProdObj As SmApplic.ISmObject
Dim SessionUtil As SmUtil.SmSessionUtil
Dim RetrievedObject As SmApplic.ISmObject
Dim Revision As String
Set PrmId = New SmRecList.SmRecord
PrmId.AddHeader "TDM_ID", 40, sdtChar
PrmId.AddHeader "REVISION", 40, sdtChar
PrmId.Value("TDM_ID") = "CATPRD-0515"
' PrmId.Value("REVISION") = "a.7"
Set CatProdClass = SmSession.MetaInfo.SmClassByName("CATIA Product")
Set CatProdObj = SmSession.ObjectStore.RetrieveObjectByPrimaryIdentity(CatPro dClass.ClassId, PrmId)
It all works except is sets CatProdObj to Nothing, so I can't copy the file to another directory, (which is what I think I need to do to access it)
Edited by: angiep