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!

How To Unhide Everything Inside A Specifically Named GeoSet

Status
Not open for further replies.

jzecha

Aerospace
Jan 20, 2016
236
Ok so a little background on the need for this macro.
My company uses Catia on the shop floor to build tools with.

When a Customer sends us a NX model, we run it though a conversion software that creates great Catia Files.
The only issue is due to the way the layers might have been saved in NX, some of the features come in hidden.

For instance the PMI comes in a GeoSet called "PMI" in ever part/product that has PMI.
This folder is usually hidden, and sometimes contains Sub GeoSets inside it that are also hidden.

I want to find the PMI GeoSets and unhide them and all of their sub Geosets, Lines, and Points.

Can someone give me some advice how to do this on a big product?

I build this macro that unhides the "PMI" GeoSet but nothing underneath:
Code:
Language="CATSCRIPT"

Sub CATMain()

CATIA.RefreshDisplay = False

Set  ProductDocument1 = CATIA.ActiveDocument
Set Product1 = ProductDocument1. Product

Dim ProductDoc1_As_Document
Set ProductDoc1 = Catia.ActiveDocument

Dim Selection1_As_Selection
Set Selection1 = ProductDoc1.Selection

selection1.Search "Name=*PMI*,All"
'selection1.Search "(Name=*PMI* & CATPrtSearch.OpenBodyFeature),all"
Set visPropertySet1 = Selection1.visProperties
VisPropertySet1.SetShow 0
Selection1.Clear

Dim specsAndGeomWindow1 As Window
Set specsAndGeomWindow1 = CATIA.ActiveWindow

Dim viewer3D1 As Viewer
Set viewer3D1 = specsAndGeomWindow1.ActiveViewer

Dim viewpoint3D1 As Viewpoint3D
Set viewpoint3D1 = viewer3D1.Viewpoint3D

viewer3D1.Reframe 

Set viewpoint3D1 = viewer3D1.Viewpoint3D

CATIA.RefreshDisplay = True

End Sub
 
Replies continue below

Recommended for you

You have almost nailed it, replace second Search with:

selection1.Search "Name=*,sel"
 
I am confused about your direction, do you mind giving me a little more explanation?

I tried this and it didn't work:

selection1.Search "Name=*PMI*,All"
selection1.Search "Name=*,sel"
Set visPropertySet1 = Selection1.visProperties
VisPropertySet1.SetShow 0
Selection1.Clear
 
First .Search call finds features named *PMI* within the whole part (",all" modifier)
Second .Search call finds all features within current selection (",sel" modifier), that is inside previously found *PMI* features.

Above code works as expected.
 
This works perfectly, thanks for the explanation.

I went back to my original code and somehow missed the comma between *PMI* and All in the first selection.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor