Jump to content

Add-On Resources


---
 Share

Recommended Posts

  • 3 weeks later...

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

 Share

×
×
  • Create New...