How can we import multiple CAD geometries in a folder to SimLab 2021.2(using script)?

mamallan
mamallan Altair Community Member
edited August 2023 in Community Q&A

I have more than 10 CAD files in a folder and I need to import them all at once using scripting into SimLab 2021.2.

Can someone help me in achieving this?

Answers

  • AlessioLibrandi
    AlessioLibrandi
    Altair Employee
    edited July 2022

    Hello, this task is handled in Altair's SIMLAB AUTOMATION training (that I recommend you to attend).

    I copy here the explanation given in the Training.

     

    So, let's assume you want to control which file is loaded from your folder uding  a SimLab Parameter (called $CAD) and/or using a Python variable (called CADfile). Follow the syntax suggested in the slides below. 

    image

     

    image

    image

     

    You can also avoid using the SimLab parameter and use directly the Python Variable (in our example it is called CADfile) in your script.

    image

     

    Create a cycle in which the Python Variable assumes all the names of your file list, and then let the Import command run multiple times.

     

    I hope this helped.

     

    Alessio - SimLab Global Tech Team

  • AlessioLibrandi
    AlessioLibrandi
    Altair Employee
    edited July 2022

    Hello, this case is handled in put SimLab Automation Training, I make a summary below of the main points.

     

    You can control which file you want to import from your folder using a SimLab Parameter (called below $CAD) and/or a python variable (called below CADfile).

    imageimage

    image

     

    YOu can create a cycle in which the CADfile variabl,e assumes all the values of your name list and so import all files.

     

    I hope this helped

    Alessio Librandi - Global Tech Team

  • Rafael Silva_20528
    Rafael Silva_20528 New Altair Community Member
    edited July 2022

    Hello,

    Just complementing Alessio`s answer. In the learning center we have an example on meshing all CAD files from a given folder. You can use the Import CAD script lines as reference for your case.

    https://web.altair.com/altair-for-simlab-learning-center

     

    image