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!

Search for Capture object in a products

Status
Not open for further replies.

USB Memory

Mechanical
May 28, 2020
44
JP
Hi all

I want to get a capture object Directly under a product by VBA.
sample1_kzcplt.png

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]
 
Replies continue below

Recommended for you

Why not to preselect product you want to search in and use ",sel" instead of ",all"?
 
Thank you for your response, Little Cthulhu.

I dont't want to search all components like "Captures" under selected product.
Example, many products linkes in a tree like "product[A]---Product---Product[C]"(the sample picture attatched is wrong becase of only one product)
※[A] is parent,,[C] are a children.

If I slect [A] by using "sel",maybe and [C] could be selected.
In this case , I want to get the capture under the [A], And next under the , also next under the [C] along the script I put.

If there is a way to get Capture object without using search method, It is the Best.

regards
 
maybe this will help: thread560-421924

regards,
LWolf
 
Thank you for your response, LWolf.

I have just checked the link you attached.
Thread560-421924 says to get a capture object under the CatPart.

In my case, I need a example to get the capture under the CatProduct.
I think that the CatPart has AnnotationSet but the CatProduct doesn't have it internally.

regards
 
Code:
Dim sets as AnnotationSets
set sets = product.GetTechnologicalObject("CATAnnotationSets")
 
Thank you very much, Little Cthulhu.

The script you put is close my image.
but I can't find the parent of an object(parent is a product I think).
It is unable to associate a product and annotationSets it has.
So I also need information about a product which has the annotationSets got by the script.

regards
 
No idea what you're talking about.

[tt]product[/tt] in [tt]product.GetTechnologicalObject[/tt] is the parent
 
It' seemed to get all annotationSets in spite of the different product which is "product" of "product.GetTechnologicalObject".
In my script put the top of this thread, is "pro1" the product you said ?

I don't know how to associate with a product and annotationSets.

regards
 
Ok, I see now.

[tt]GetTechnologicalProduct[/tt] retrieves all annotation sets of the active document, which looks like a bug to me.
It can be retrieved in Knowledgeware though ([tt]ProductReference[/tt] property of [tt]CATTPSSet[/tt] type).
 
This is more real on my situation
sample_soivg2.png


This is my verification about using GetTechnologicalObject bellow.
1. If I selected the ptroduct1(Active) and did GetTechnologicalObject, All AnnotationSets are retrieved
2. If selected the product2(Active), AnnotationSets under the Product2 are retrieved.

It looks like a specification to retrieved an AnnotationSets under the ActiveDocument.
Based on this situation, I want to select the ptroduct1 and Process each product to retrieved their annotationset in order by vba.

If you have a solution, I want a sample script.
I'm sorry, but I don't understand what "It can be retrieved in Knowledgeware though (ProductReference property of CATTPSSet type)." mean

regards
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top