How to use numpy in Mechanical Scripting?

ZZ.tang
ZZ.tang Member Posts: 14
First Comment Name Dropper
**

Ansys 2023 R1

Best Answer

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 867
    500 Comments Photogenic Name Dropper Solution Developer Community of Practice Member
    ✭✭✭✭
    Answer ✓

    Hi @ZZ.tang , currently Mechanical Scripting is based on IronPython, so it is not possible to use Numpy, which is based on CPython. There is a beta option you can turn on to activate the possibility to use CPython in Mechanical but it is beta (ie, we do not guarantee it will work and do not provide support over it).
    From the WB project schematic, go to tools /options / appearance and select "beta option":

    Then, in the same menu, go to Mechanical and activate "Show CPython Capability":

    Another method to be able to use Numpy with Mechanical would be to use PyMechanical.

Answers