How to use numpy in Mechanical Scripting?

ZZ.tang
ZZ.tang Member Posts: 23
10 Comments First Anniversary Name Dropper
**

Ansys 2023 R1

Best Answer

  • Pernelle Marone-Hitz
    Pernelle Marone-Hitz Member, Moderator, Employee Posts: 871
    100 Answers 500 Comments 250 Likes First Anniversary
    ✭✭✭✭
    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