[De...] Posted October 15 Share Posted October 15 Hi, I was wondering if I could import a .gelement/.zelement /.gxml as an add-on resource, then import that resource into my project (clipboard). I tried reading https://zeissiqs.github.io/zeiss-inspect-addon-api/2023/howtos/python_api_introduction/using_script_resources.html but I'm not having much luck... Any advice? Link to comment Share on other sites More sharing options...
[Ma...] Posted November 4 Share Posted November 4 Hi, import_gom_inspection_exchange needs a regular file name, neither a file handle nor a resource object works instead. You can use the following workaround: import gom import tempfile import os # Copy the resource to a regular (temporary) file with gom.Resource('Points.gxml').open() as gxml_file, tempfile.NamedTemporaryFile(delete=False) as temp_file: data = gxml_file.read() temp_file.write(data) # Import from temporary file gom.script.sys.import_gom_inspection_exchange (files = [temp_file.name], import_mode = 'clipboard') # Remove temporary file try: os.remove(temp_file.name) except: pass Best regards, Matthias 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