USB Memory
Mechanical
Hi all
I want to get a capture object Directly under a product by VBA.
There is a way which is using a search method for to get a capture object.
I want to know a way to get the object Without using a serch method.
Otherwise if each capture objects under a products can be searched by using
this script bellow, it is good as well.
The problem of this script is only to get a capture under selected product(ActiveDocument).
It is good to get a captures under a each products, not all at once like this "CATTPSSearch.CATTPSCapture,all".
'=================================================================================================
Sub CATMain()
Dim productDocument1 As ProductDocument
Set productDocument1 = CATIA.ActiveDocument
Dim product1 As Product
Set product1 = productDocum ent1.Product
Dim products1 As Products
Set products1 = product1.Products
Call ExecuteRecursiveSearch(products1)
End Sub
Private Function ExecuteRecursiveSearch(ByVal products1 As Products)
Dim pro1 As Product
Dim partDocument1 As PartDocument
Dim selection1 As Selection
With pro1
For Each pro1 In products1
[highlight #CC0000]Set selection1 = pro1.Application.ActiveDocument.Selection[/highlight]
selection1.Search "CATTPSSearch.CATTPSCapture,in"
Debug.Print pro1.Name
Set prtDocument1 = pro1.ReferenceProduct.Parent
Set products2 = pro1.Products
Call ExecuteRecursiveSearch(products2)
Next pro1
End With
End Function
'=================================================================================================
This is close my image but not working.
[highlight #CC0000]'Set selection1 = prs1.Application.Documents.Item(prs1.ReferenceProduct.Parent.Name).Selection[/highlight]
I want to get a capture object Directly under a product by VBA.
There is a way which is using a search method for to get a capture object.
I want to know a way to get the object Without using a serch method.
Otherwise if each capture objects under a products can be searched by using
this script bellow, it is good as well.
The problem of this script is only to get a capture under selected product(ActiveDocument).
It is good to get a captures under a each products, not all at once like this "CATTPSSearch.CATTPSCapture,all".
'=================================================================================================
Sub CATMain()
Dim productDocument1 As ProductDocument
Set productDocument1 = CATIA.ActiveDocument
Dim product1 As Product
Set product1 = productDocum ent1.Product
Dim products1 As Products
Set products1 = product1.Products
Call ExecuteRecursiveSearch(products1)
End Sub
Private Function ExecuteRecursiveSearch(ByVal products1 As Products)
Dim pro1 As Product
Dim partDocument1 As PartDocument
Dim selection1 As Selection
With pro1
For Each pro1 In products1
[highlight #CC0000]Set selection1 = pro1.Application.ActiveDocument.Selection[/highlight]
selection1.Search "CATTPSSearch.CATTPSCapture,in"
Debug.Print pro1.Name
Set prtDocument1 = pro1.ReferenceProduct.Parent
Set products2 = pro1.Products
Call ExecuteRecursiveSearch(products2)
Next pro1
End With
End Function
'=================================================================================================
This is close my image but not working.
[highlight #CC0000]'Set selection1 = prs1.Application.Documents.Item(prs1.ReferenceProduct.Parent.Name).Selection[/highlight]