Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Existing publications in product assembly

Status
Not open for further replies.

MKEdits

Mechanical
Jan 9, 2023
31
0
0
PL
Hello guys, I just got into macro writting in VBScript and i got requested to prepare macro which checks if particular sketch was published and if it has proper name (if possibly change color of notpublished sketch / wrong named publication). It all happens in product assembly which includes many subproducts with parts in it. As i did research i couldn't find exact way to automatize it, i've found many macros which can delete not linked publications but those are not what im looking for.
Everything should happen after:

If (intRC = vbYes) Then
Dim productDocument1
Set productDocument1 = CATIA.ActiveDocument

Dim partDocument1

Dim selection1
Set selection1 = productDocument1.Selection

Dim InputObjectType(0)
InputObjectType(0) = "Product"


status= selection1.SelectElement3(InputObjectType, "Choose console", False, CATMultiSelectionMode.CATMultiSelTriggWhenUserValidatesSelection, False)
Dim selected_object

Set selected_object = selection1.Item(1).Value
 
Replies continue below

Recommended for you

I made some improvements, now i can find publications but can i make a condition to search only in publications or do i need to select it by myself?

Regards,
M
 
you can get hold of publications...

Dim publications1 As Publications
Set publications1 = MyProduct.Publications

regards,
LWolf
 
Status
Not open for further replies.
Back
Top