Script in SpaceClaim : problem

  • 233 Views
  • Last Post 12 March 2020
  • Topic Is Solved
pinkerthoms posted this 03 February 2020

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

Order By: Standard | Newest | Votes
rwoolhou posted this 03 February 2020

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

pinkerthoms posted this 03 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. 

pinkerthoms posted this 05 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.

SilviaHervas posted this 11 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.

pinkerthoms posted this 12 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

Close