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

Options
Ansys Staff
Ansys Staff 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

  • Doug Addy
    Doug Addy Member, Employee Posts: 21
    First Anniversary Name Dropper First Answer Ansys Employee
    Answer ✓
    Options

    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:

    from GRANTA_MIScriptingToolkit import granta as mpy
    
    session = mpy.Session('my_server/mi_servicelayer', autologon=True)
    queue = session.get_async_job_queue()
    
    job_request = mpy.TextImportJobRequest('job_name',
                                           description='A test job with two files',
                                           data_files=['./file_1.txt', './file_2.txt'],
                                           template_files=['./template.txt'])
    job = queue.create_import_job(job_request)
    
    #...wait for job to complete
    

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