Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

NX Open support for numpy/scipy?

Does the NX Open API offer support for the numpy/scipy libraries? If not, is there a way to add support for those libraries?

 

I tried to run some python journal files but got error messages when trying to run them. 

 

import numpy
import scipy
23 REPLIES

Re: NX Open support for numpy/scipy?

The Python installation delivered with NX (%UGII_BASE_DIR%\ugii\python) contains only core modules, so imports for extensions such as numpy and scipy will not work.

 

To use these modules, you need a standalone Python installation with the modules installed. NX uses the following environment variables:

 

PYTHONPATH

UGII_PYTHON_HOME

UGII_PYTHON_DLL

UGII_PYTHON_LIBRARY_DIR

UGII_PYTHONPATH

TCL_LIBRARY

 

An example of these set to use the Python installation delivered with NX is:

 

PYTHONPATH=C:\apps\Siemens\NX\10.0\UGII\python

UGII_PYTHON_HOME=C:\apps\Siemens\NX\10.0\UGII\python
UGII_PYTHON_DLL=python33.dll
UGII_PYTHON_LIBRARY_DIR=C:\apps\Siemens\NX\10.0\UGII\python
UGII_PYTHONPATH=C:\apps\Siemens\NX\10.0\UGII\python;C:\apps\Siemens\NX\10.0\UGII\python\Python33.zip

TCL_LIBRARY=C:\apps\Siemens\NX\10.0\UGII\python\tcl8.5

 

Setup to use a standalone Python installation:

 

PYTHONPATH=C:\apps\Python\33;C:\apps\Python\33\Lib;C:\apps\Python\33\libs;C:\apps\Python\33\DLLs;C:\apps\Siemens\NX\10.0\UGII\python

UGII_PYTHON_HOME=C:\apps\Python\33
UGII_PYTHON_DLL=python33.dll
UGII_PYTHON_LIBRARY_DIR=C:\Windows\System32
UGII_PYTHONPATH=C:\apps\Python\33;C:\apps\Python\33\Lib;C:\apps\Python\33\libs;C:\apps\Python\33\DLLs;C:\apps\Siemens\NX\10.0\UGII\python

TCL_LIBRARY=C:\apps\Python\33\tcl\tcl8.5

Re: NX Open support for numpy/scipy?

@JimB,

When using a .net language, you must have an author license to use other "libraries"; without an author license you are limited to the NX dll's and some of the core .net dll's. Is there a similar limitation with Python?

Re: NX Open support for numpy/scipy?

@JimB Thanks, that helps a great deal!

 

I think NX Open is set up for Python 3.3.2

 

Can I set the env variable to other releases (3.5, 2.7, etc)?

Solution
Solution
Accepted by topic author AlexLee
‎02-16-2016 04:11 PM

Re: NX Open support for numpy/scipy?

As Jim indicated use a standalone python install such as Winpython or Anaconda which contains numpy and scipy. 

Re: NX Open support for numpy/scipy?

@cowski1: No, there are no limitations with Python. You can use the Python bundled with NX or a standalone installation that includes any external packages that you want/need.

 

Re: NX Open support for numpy/scipy?

[ Edited ]

These environment variables worked fine

 

PYTHONPATH=C:\Program Files\Siemens\NX 10.0\UGII\python

UGII_PYTHON_HOME=C:\Program Files\Siemens\NX 10.0\UGII\python

UGII_PYTHON_DLL=python33.dll

UGII_PYTHON_LIBRARY_DIR=C:\Program Files\Siemens\NX 10.0\UGII\python

UGII_PYTHONPATH=C:\Program Files\Siemens\NX 10.0\UGII\python;C:\Program Files\Siemens\NX 10.0\UGII\python\Python33.zip

TCL_LIBRARY=C:\Program Files\Siemens\NX 10.0\UGII\python\tcl8.5

 

Then I installed Python 3.3.2 and Numpy 1.10.2. I wasn't able to find a version of Anaconda specifically for 3.3.2. Haven't looked into Win Python yet.

 

Next, I tried these environment variables and I get a "General Fault Exception" error.Should  UGII_Python_Library be set differently?

 

PYTHONPATH= C:\Python33;C:\Python33\Lib;C:\Python33\libs;C:\Python33\DLLs;C:\Program Files\Siemens\NX 10.0\UGII\python

TCL_LIBRARY=C:\Python33\tcl\tcl8.5

UGII_PYTHON_HOME=C:\Python33

UGII_PYTHONPATH= C:\Python33;C:\Python33\Lib;C:\Python33\libs;C:\Python33\DLLs;C:\Program Files\Siemens\NX 10.0\UGII\python

UGII_PYTHON_DLL=python33.dll

UGII_PYTHON_LIBRARY_DIR =C:\Windows\System32

 

Re: NX Open support for numpy/scipy?

@3Dartist: You can certainly try Smiley Happy

 

Siemens PLM only tests/supports the documented release. Similar releases (i.e. 3.3.5) will probably work with the standard caveat that it's based on the packages upward compatibility claims.

 

2.7 will definitely not work.

Re: NX Open support for numpy/scipy?

@3Dartist, Does C:\Windows\System32 contain a copy of python33.dll? This is typically put there by the python installer (at least the one I use from python.org, i.e. https://www.python.org/download/releases/3.3.2/

 

 

Re: NX Open support for numpy/scipy?

[ Edited ]

@JimB Thanks for your detailed responses. I would not have gotten this far without them!

 

C:/Windows/System32 strangely enough does not have a python33.dll

 

I did use the same installer in that link (Python 3.3.2 x86 non 64 bit)

 

I just tried setting UGII_PYTHON_LIBRARY_DIR=C:\Python33\Lib;C:\Python33\libs

 

but that did not work either.