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!

Define or open each Part in Product tree

Status
Not open for further replies.

Macro2015

Automotive
Jan 19, 2015
10
SI
Hello,

I would like to define each part in product tree structure. I can not find the proper result.

Maybe i could do with selection to select each part in product tree and open.
It could be solved with selection.part.item(i) and startcommad(open in new window). Have any idea how to program that. Please check the code below.

Thank you!

'***************************************************

Sub CATMain()

Dim Product As ProductDocument

On Error Resume Next

Set Product = CATIA.ActiveDocument


Dim aProduct As Product
Set aProduct = Product.Product


Set productDocument1 = CATIA.ActiveDocument



Dim selection1 As Selection

Set selection1 = productDocument1.Selection


selection1.Search "CATProductSearch.Part,all"


For X = 1 To selection1.Count

Dim Part As Part
Set myPart = productDocument1.Parts.Item(X)

selection1.Search "CATProductSearch.Part,all"
Set Part = selection1.Item2(X).Value.ReferenceProduct.Parent.Part

MsgBox Part.Name ' DISPALYS PART NAME

' !!!!!!!!!!!!HERE I WOULLD LIKE TO DEFINE THE PART (LIKE DOUBLE CLICK) !!!!!!!!!!
' or open in new window


Next



End Sub

 
Replies continue below

Recommended for you

Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top