Script in SpaceClaim : problem

pinkerthomspinkerthoms BelgiumMember Posts: 19

Hi,

 

How can I import numpy and scipy libraries in SpaceClaim ?

Or how can I launch an external Python script in it ? 

I can't find anything to do these things. 

 

Thanks,

Thomas

Comments

  • RobRob UKForum Coordinator Posts: 8,395
    edited February 2020

    There's a Scripting section in the manual, check under the Customising SpaceClaim section. 

  • pinkerthomspinkerthoms BelgiumMember Posts: 19
    edited February 2020

    Thank you for your quick answer. Unfortunately, there is nothing about adding new libraries or running an external python script in this section. 

  • pinkerthomspinkerthoms BelgiumMember Posts: 19
    edited February 2020

    Guys, I found a solution to run an external python script in SpaceClaim : 

    from System.Diagnostics import Process
    Process.Start("File.py")

     

    Make sure you have Python installed on your device and that all the libraries needed are downloaded. In my case, I needed numpy & scipy. So, in the Windows terminal (Windows + R -> "cmd" -> Ok), you have to write : 

    pip3 install numpy 

    pip3 install mkl 

    pip3 install scipy

     

    I hope it is going to help some people,

     

    Thomas.

  • SilviaHervasSilviaHervas Zaragoza, SpainMember Posts: 1
    edited March 2020

    Hi,

    I also want to run python codes which include libs as scipy and numpy.

    Could you please explain in more detail what you've done? I've tried those commands and they do not work for me.

    Also, have you run numpy in ansys act?

     

    Thanks!!

    Silvia.

  • pinkerthomspinkerthoms BelgiumMember Posts: 19
    edited March 2020

    Hi Silvia, 

    If you want to run external python scripts from SpaceClaim (IronPython), you first need to download the latest version of Python from the Windows store.
    Once it is done, just run the Windows terminal (Windows key + R) and write the command lines I wrote above (pip3 … ). It should work. At least, that is how I did it (https://www.edureka.co/blog/install-numpy/). From there, to be able to call an external python script (i.e. a ".py" file) in a SpaceClaim script, you have to write the two lines above (from System.Diagnostics … ).


    Unfortunately, I never run numpy in Ansys ACT but I remember finding a video that seemed interesting, judging by the comments :

     

    I hope this helps. Feel free to ask more questions if your problem is still unresolved.

     

    Thomas

Sign In or Register to comment.