Just embed the NX python folder in the project structure.
I'm using Pycharm with windows but I assume it is the same with linux.
At the moment I'm just experimenting with the NX/Python capabilities and I only use the IDEs autocomplete etc. to create and modify simple journals. I currently didn't set up a fully fledged development environment.
(So hints for further integration (e.g. debugging) would be appreciated from my side too).
I am still not able to configure it. When I add the folder structure I will get error that Python33.dll have conflict with current version of Python. Can you please tell me which python and Nx version are you using. And anything else I need to add to make it work
Are you able to import NXOpen in console?? So that intellisense works atleast in console..
I would also be interested to know if someone has managed to get that to work or if any other IDE could work with the combo NXOpen / python.
That would save hours if not days!
I've got it working. Partially that is.
What works: starting nx batch session from pycharm, code completion in the python console in pycharm
What does not work: code completion in the editor. He still marks the import of NXOpen as failing, but manages to execute it without problems. A new instance of NX is started as soon as NXOpen.Session.GetSession() is executed.
You need a python installation whose version fits your NX version - 3.3 for NX10, 3.4 for NX11 or NX12. Choose that as interpreter in pycharm.
Then it's just a matter of having all the NX specific environment variables set up before you start pycharm - especially UGII_ROOT_DIR and UGII_BASE_DIR and LD_LIBRARY_PATH. And under windows, i think you might have to add your UGII_ROOT_DIR to PATH additionally.
At some point I had eclipse with pydev set up to debug with a running NX session - that also worked partially. The debugger funcitonality was limited enough that I decided that it was not worth it.
I've defaulted to having an nxtest script in which I import whatever I'm currently working on, and I execute that test script by hand in an interactive NX session - not pretty but it works.
Hope that helps.
If you can't get it to work - what are your environment variables? There is probably something missing.
Are you using the free version of pycharm?
I have given Eclipse a try following the steps in that document but with no success at all.
I'm on NX11 and using an external version of python.
These are the env variables I have setup in pycharm (same as the windows env variables + the ug root dir added as per you comment):
I still can't get it to work:
Any idea on what could be wrong ?
Oh, I forgot to mention one step! I add the nx python dir as a content root in pycharm.
In settings, project structure, add content root add your NXDIR/nxbin/python
Also I don't see a PATH env var, maybe you need to add that? I work under Linux, so my Windows information is from a colleague.
Alternatively, you can set that in the PYTHONPATH (not UGII_PYTHONPATH) - that should have the same effect if I am not mistaken.
A couple of points of clarification to the following:
You need a python installation whose version fits your NX version - 3.3 for NX10, 3.4 for NX11 or NX12. Choose that as interpreter in pycharm. Then it's just a matter of having all the NX specific environment variables set up before you start pycharm - especially UGII_ROOT_DIR and UGII_BASE_DIR and LD_LIBRARY_PATH. And under windows, i think you might have to add your UGII_ROOT_DIR to PATH additionally.
I'm a bit confused now!
The environement variables are set in windows and they are most likely right because I can run various scripts that use modules not present in the NX Python library. I'm using Anaconda build with python 3.4.3 as required for NX 11.0
So I am assuming you guys are talking about setting up env. variables in pyCharm there:
I'm not sure what else I need to specify apart from those?
I've received from the helpdesk the following pdf to guide thru the setup of Eclipse but it works for NX10.0 and eventhough I've modified the startup script to point to NX11 folders, still no success.
I'll try to get them to remotly do the install, maybe they'll manage to make it work.