从NX 10开始,NX Open增加了对Python的支持,使得NX脚本语言的多元性进一步得到扩充。但对于大多数用户来说,选择Python作为脚本语言,主要是想利用Python社区提供的各种函数库或功能包,比如在科学计算和数据处理中常用的numpy、scipy、matplotlib、scipy等等。然而遗憾的是,NX中的Python只包含Python的基本功能,不能自行安装其他函数库或功能包,这使得Python存在的意义大为降低。不过NX提供选择其它Python解释器作为NX的解释器,这样就可以解决这个问题。
在Siemens的论坛上,有一个帖子详细解释了这个设置的方法:
其实这个方法在NX 10的说明页面里有,但后续版本不知道移到哪里去了……
下面是从NX 10说明页面复制的设置方法,其中ugii_env.dat文件可以通过在NX的安装目录里搜索定位
Using external Python distribution
The Python distribution included in NX is Python 3.3.2 with the PLY extension module included. If you use other Python extension modules, you can set up NX to use a Python distribution that you install that includes the other extension modules.
Specify the external Python distribution for NX to use with the UGII_PYTHON_LIBRARY_DIR and UGII_PYTHONPATH environment variables. You can set these environme