[Fe...] Posted August 15, 2025 Share Posted August 15, 2025 Help! How do I use Python to control GOM INSPECT, quickly export STL files, import STL files from a folder into a project template, automatically refresh reports, and save PDF and CSV files? Link to comment https://qualityforum.zeiss.com/topic/24203-help-how-do-i-use-python-to-control-gom-inspect-quickly-export-stl-files-import-stl-files-from-a-folder-into-a-project-template-automatically-refresh-reports-and-save-pdf-and-csv-files/ Share on other sites More sharing options...
[DW...] Posted August 15, 2025 Share Posted August 15, 2025 Please sign in to view this quote. Please sign in to view this username. Go into the Add-Ons menu, and click on Add-on Editor. You might need to make a template folder, then you will see the scripting area to the right. Record a macro and do all of the things you stated. Then tweak the macro using Python syntax or feed it into GPT. Link to comment https://qualityforum.zeiss.com/topic/24203-help-how-do-i-use-python-to-control-gom-inspect-quickly-export-stl-files-import-stl-files-from-a-folder-into-a-project-template-automatically-refresh-reports-and-save-pdf-and-csv-files/#findComment-136835 Share on other sites More sharing options...
[Ri...] Posted August 15, 2025 Share Posted August 15, 2025 (edited) https://zeissiqs.github.io/zeiss-inspect-addon-api/2025/howtos/python_api_introduction/python_api_introduction.html Here is the documentation. Depending on how automated of a solution you want will dictate how easy this is to implement. Here is a script for importing files, converting them to STEP, and then exporting them. # -*- coding: utf-8 -*- import gom from PyQt5.QtWidgets import QApplication, QFileDialog import sys import os app = QApplication(sys.argv) # Set default folder path default_folder = r"" file_path, _ = QFileDialog.getOpenFileName(None, "Select an STL file", default_folder, "STL Files (*.stl)") if not file_path: print("No file selected. Operation canceled.") sys.exit() try: gom.script.sys.import_stl( bgr_coding=True, files=[file_path], geometry_based_refining=False, import_mode='clipboard', length_unit='mm', stl_color_bit_set=False, target_type='mesh' ) gom.script.part.create_new_part(name='Part') print("Imported Actual Elements:") for element in gom.app.project.clipboard.actual_elements: print(" -", element) gom.script.part.add_elements_to_part( delete_invisible_elements=True, elements=[el for el in gom.app.project.clipboard.actual_elements], import_mode='new_elements', part=gom.app.project.parts['Part'] ) gom.script.sys.switch_to_mesh_editing_workspace() MCAD_ELEMENT = gom.script.mesh.automatic_cad_surface_from_mesh( merge=True, mesh=gom.app.project.parts['Part'].actual, name='CAD group 1', number_of_quads=100000, preview_type=1 ) step_folder = r"" os.makedirs(step_folder, exist_ok=True) filename = os.path.splitext(os.path.basename(file_path))[0] step_export_path = os.path.join(step_folder, f"{filename}.step") print("Nominal Elements for STEP Export:") for el in gom.app.project.clipboard.nominal_elements: print(" -", el) gom.script.sys.export_step( elements=[el for el in gom.app.project.clipboard.nominal_elements], file=step_export_path ) print(f"STEP file exported to {step_export_path}") gom.script.cad.delete_element( elements=gom.ElementSelection({'category': ['key', 'elements', 'is_element_in_clipboard', 'True', 'explorer_category', 'nominal', 'object_family', 'cad']}), with_measuring_principle=True ) print("Process completed successfully!") except Exception as e: print(f"❌ Error occurred: {e}") Edited August 15, 2025 Link to comment https://qualityforum.zeiss.com/topic/24203-help-how-do-i-use-python-to-control-gom-inspect-quickly-export-stl-files-import-stl-files-from-a-folder-into-a-project-template-automatically-refresh-reports-and-save-pdf-and-csv-files/#findComment-136837 Share on other sites More sharing options...
[Fe...] Posted August 18, 2025 Author Share Posted August 18, 2025 Please sign in to view this username. Thank you for sharing, but since I have no experience with this operation and am unsure how to modify it using Python, I may not be able to proceed. Link to comment https://qualityforum.zeiss.com/topic/24203-help-how-do-i-use-python-to-control-gom-inspect-quickly-export-stl-files-import-stl-files-from-a-folder-into-a-project-template-automatically-refresh-reports-and-save-pdf-and-csv-files/#findComment-136873 Share on other sites More sharing options...
[Fe...] Posted August 18, 2025 Author Share Posted August 18, 2025 Please sign in to view this username. Dear Richard, I will test the content you shared. Do you have a script for automatically refreshing reports? If so, could you share it with me? Thank you. Link to comment https://qualityforum.zeiss.com/topic/24203-help-how-do-i-use-python-to-control-gom-inspect-quickly-export-stl-files-import-stl-files-from-a-folder-into-a-project-template-automatically-refresh-reports-and-save-pdf-and-csv-files/#findComment-136875 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