[Ch...] Posted February 4, 2021 Share Posted February 4, 2021 Hi, all, How do I create a selection of all parts contained in a project in a GOM script? Is there something similar to gom.ElementSelection({'category': ['key', 'elements', 'explorer_category', 'actual', 'object_family', 'mesh']}) which creates a selection of all meshes in a project? Christian Keck Link to comment Share on other sites More sharing options...
[Ad...] Posted February 24, 2021 Share Posted February 24, 2021 Hello, I use this method in my scripts: import gom def get_all_meshes(): meshes = [] for part in gom.app.project.parts: for mesh in gom.ElementSelection ({'category': ['key', 'elements', 'part', part, 'explorer_category', 'actual_part']}): meshes.append(mesh) return meshes gom.script.cad.show_element_exclusively (elements=get_all_meshes()) Link to comment Share on other sites More sharing options...
[An...] Posted February 26, 2021 Share Posted February 26, 2021 Hallo Christian, maybe this helps you out: all_actual_meshes = [i for i in gom.ElementSelection ({'category': ['key', 'elements', 'explorer_category', 'actual_part']})] This selects all actual meshes of all parts in a project and puts them in a list. The same for the nominal meshes: all_nominal_meshes = [i for i in gom.ElementSelection ({'category': ['key', 'elements', 'explorer_category', 'nominal_part']})] And this one selects all parts and puts them in a list: all_parts = [i for i in gom.app.project.parts] Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in