Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

CATIA VB : Get document path from product 1

Status
Not open for further replies.

Suncad

Mechanical
Oct 30, 2013
44
FR
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 :
94184_tree.png


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

Thanks if someone here can help me.
 
Replies continue below

Recommended for you

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
 
Thanks a lot !

That is exactly what I was looking for :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top