vbacatia

Selecting faces from PartBody by color with a VBA macro


Is it possible to select the faces of a solid in a PartBody by filtering them by colour using a VBA macro or any other programaticaly way? Do you have any tips on how to do this?

Thank you very much!


Solution

  • sQuery = "(Topology.Face & Color=Blue),all"
    CATIA.ActiveDocument.Selection.Search(sQuery)
    

    In interactive CATIA, use CTRL+F (search) and mess around until you get the search exactly right. Then click the "add to favorites" button and copy the search string out of the dialog and paste it into your code as the search query. This trick will work most every time.

    You can of course alter the query string in your program if you need.