Continue to Site

Welcome to MCAD Central

Join our MCAD Central community forums, the largest resource for MCAD (Mechanical Computer-Aided Design) professionals, including files, forums, jobs, articles, calendar, and more.

Open from smarteam with VB


New member
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.



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!!


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
Whew! I figured out what my problem was.

It turns out, I was not properly connecting with smarteam, and that's why it wasn't finding it!

I have catia materials including the followings:

catia v5 r17 sp3 Software 2CD
catia v5 r17 Help document 4CD
CATIA v5r17 Training 20CD
catia v5 A-class surfaces, Reverse engineering,advanced video courses with demonstrations of car 15CD .
Otherwise there are some other training courses,

These CDs are not for free. If anyone wants to buy, please email to [email protected].

The above URL are just part of demostrations. This is my e-shop.


Articles From 3DCAD World