Can you use Granta MI Text Import template to import multiple files using STK?

Member, Employee Posts: 24
Ansys Employee Name Dropper First Comment Photogenic
✭✭✭✭
edited June 2023 in Materials

Can you use Granta MI Text Import template to import multiple text files using STK 2.3?

Assuming the text import template is set up to work within Granta MI Import and python STK is being used to automate the process.

Answers

  • Member, Moderator, Employee Posts: 22
    Second Anniversary 5 Answers 10 Comments Name Dropper
    ✭✭✭✭
    Answer ✓

    Yes you can, the available methods follow the options available within the OneMI Import app, you can import multiple text files and multiple attachments. Here's an example with two data files:

    1. from GRANTA_MIScriptingToolkit import granta as mpy
    2.  
    3. session = mpy.Session('my_server/mi_servicelayer', autologon=True)
    4. queue = session.get_async_job_queue()
    5.  
    6. job_request = mpy.TextImportJobRequest('job_name',
    7. description='A test job with two files',
    8. data_files=['./file_1.txt', './file_2.txt'],
    9. template_files=['./template.txt'])
    10. job = queue.create_import_job(job_request)
    11.  
    12. #...wait for job to complete

    As you mention this relies upon having a valid template file configured to import into a table.

Welcome!

It looks like you're new here. Sign in or register to get started.