×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

CATIA VB : Get document path from product

CATIA VB : Get document path from product

CATIA VB : Get document path from product

(OP)
Hi there,

I do have difficulties to find out something :

I have a product, containing subproducts and parts.
I want to display the file name of each parts/products.
I can do it by using the document structure :

MsgBox CATIA.Documents.item(i).FullName

The thing is, the Document structure will skip missing files (references not foud) and I want to display the file name of missing files as well, so i'd like to use the Product structure, but product structure does'nt have a .FullName property.

To sum up :
I have a tree like this :


I want to get & display the "[Part1.CATPart]"
(and not just the product.name "Part1.1")

Thanks if someone here can help me.

RE: CATIA VB : Get document path from product

I'm not sure if i understand you.. but you can try with this...

CODE -->

Sub Get_Name()

Dim objProduct As Product
Set objProduct = CATIA.ActiveDocument.Product

Dim ProdDoc As ProductDocument
Set ProdDoc = objProduct.ReferenceProduct.Parent

Dim objStiEngine As StiEngine
Set objStiEngine = CATIA.GetItem("CAIEngine")

Dim ProdStiItem As StiDBItem
Set ProdStiItem = objStiEngine.GetStiDBItemFromAnyObject(ProdDoc)

Dim strProdDocName As String
strProdDocName = ProdStiItem.GetDocumentFullPath()

Dim curStiItem As StiDBItem
Dim strStiDocName As String

Dim StiChildrenList As StiDBChildren
Set StiChildrenList = ProdStiItem.GetChildren()

Dim i As Integer
For i = 1 To StiChildrenList.Count

Set curStiItem = StiChildrenList.Item(i)

strStiDocName = curStiItem.GetDocumentFullPath
x = Len(strStiDocName)
y = InStrRev(strStiDocName, "\")
z = x - y
MsgBox Right(strStiDocName, z)

Next i

End Sub 

RE: CATIA VB : Get document path from product

(OP)
Thanks a lot !

That is exactly what I was looking for :)

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources