PDA

View Full Version : anyone using Jetbrains PyCharm for LW?



sami
09-25-2013, 04:52 AM
Just wondering how it is and if autocomplete works for LW python api with it? I want to switch from LScript to Python and expect that the latest 11.6 build makes Python equivalent or better than LScript for LW and figured PyCharm would make my life/the switch easier if it supported LW's python api in the ide... any thoughts on this or something better than Notepad++?

http://www.jetbrains.com/pycharm/

dulo
09-25-2013, 06:49 AM
Yep .. use pycharm for about 3 years and also use it for lightwave/houdini python hacking .. is simply the best ide and the money worth a thousand times ( since yesterday there is a free open source edition of pycharm too )

clintonman
09-25-2013, 09:25 PM
Just started today. I wrote a script for auto-completion based on other posts here:
http://forums.newtek.com/showthread.php?135651-pycharm-charm
http://forums.newtek.com/showthread.php?132059-Autocompletion-for-LW-SDK-in-Python&highlight=pycharm
http://forums.newtek.com/showthread.php?131990-LWPy-amp-WingIDE

A zip archive containing the scripts is attached.

Basic steps:
install python v 2.7.x - "x" is whatever version is current
install pycharm
setup pycharm to use the python 2.7.x and the path to the lightwave bin(see the forum posts mentioned earlier)
unzip the archive to the scripts folder and run the generate_interface_files.py file and choose the python site-packages folder(C:\Python27\Lib\site-packages)

Notes:
It works on LW 11.5.1
I had to comment out the "pcore" sections to get it to work with LW 11.6
It does not see the PRIS stuff

sami
09-26-2013, 02:09 AM
Wow! That's awesome clintonman! Thanks for sharing, I'll download the new free version and try your files. That should certainly help getting up to speed with LW Python much easier!

dulo
09-26-2013, 03:09 AM
http://daniepstein.com/daniepstein/tutorials/python-blender-and-a-bit-of-debuggery
this one sounds really interesting. maybe with this technique it is even possible to debug lightwave or houdini python scripts ..

RebelHill
09-27-2013, 04:22 AM
Been a big fan of pyscripter here... https://code.google.com/p/pyscripter/

clintonman
11-12-2014, 02:33 PM
I found a way to make the pris modules work for autocomplete. The way I got it to work is to name the python files with underscores instead of periods. I get autocomplete but the import format is wrong. Can manually change it back with search and replace, but not ideal.

Basic steps are still the same:
install python v 2.7.x - "x" is whatever version is current
install pycharm
setup pycharm to use the python 2.7.x and the path to the lightwave bin(see the forum posts mentioned earlier)
unzip the archive to the scripts folder and run the generate_interface_files.py file and choose the python site-packages folder(C:\Python27\Lib\site-packages)

also works with Python Tools for Visual Studio


autocomplete works

from lwsdk_pris import center
from lwsdk_pris_modeler import Mesh, getdir, load, init, fileexists

required format for Lightwave

from lwsdk.pris import center
from lwsdk.pris.modeler import Mesh, getdir, load, init, fileexists

Any ideas?

clintonman
11-13-2014, 07:31 PM
Got it! It works if the folder structure and file names are duplicated from C:\Program Files\NewTek\LightWave11.6.3\bin\lwsdk... so instead of lwsdk.py use \lwsdk\__init__.py

Here's the latest script that provides completion for lwsdk, pris and modeler.

Diepgroen
08-13-2016, 01:19 PM
PyCharm2016 and LW2015 Autocompletion

I'm really new to LWPython but my curiosity is large .
I want to play around with the LightwaveSDK and at least start experimenting with code. I got my Jetbrain PyCharm2016.2.1 community edition today and before anything gets to complicated I'm allready stuck.

In this thread an autocompletion code for the 11.5 SDK was posted 3 years ago? Could there be someone using autocompletion for the latest Lightwave 2015 SDK? There is also a mention about setting up a path to the Lightwave.bin. I've noticed that PyCharm 2016 Settings and interface has changed and things look different. Which makes it a bit confusing to get things setup right.

If you have some tips and gotcha's on setting up Pycharm2016 to work with the LW2015 SDK and autocompletion. Please give me a shout out.

dulo
08-20-2016, 03:22 AM
PyCharm2016 and LW2015 Autocompletion

I'm really new to LWPython but my curiosity is large .
I want to play around with the LightwaveSDK and at least start experimenting with code. I got my Jetbrain PyCharm2016.2.1 community edition today and before anything gets to complicated I'm allready stuck.

In this thread an autocompletion code for the 11.5 SDK was posted 3 years ago? Could there be someone using autocompletion for the latest Lightwave 2015 SDK? There is also a mention about setting up a path to the Lightwave.bin. I've noticed that PyCharm 2016 Settings and interface has changed and things look different. Which makes it a bit confusing to get things setup right.

If you have some tips and gotcha's on setting up Pycharm2016 to work with the LW2015 SDK and autocompletion. Please give me a shout out.

As far as I can remember you have to install with uncompressed python files ( installer ) and then point pycharm to this directory. I will take a look at the current way in the evening and update you.

Diepgroen
08-20-2016, 04:27 AM
As far as I can remember you have to install with uncompressed python files ( installer ) and then point pycharm to this directory. I will take a look at the current way in the evening and update you.

I'm excited. I did somehow get the 11.6 autocompletion to function as examples has been mentioned before in this thread. Looking forward to getting the 2015.3 autocompletion working.

Glad you can look into it dulo.

Diepgroen
11-02-2016, 03:47 AM
I finally wrapped my head around using the generate_interface.py script to produce the lwsdk.py and pcore.py for autocompletion in PyCharm. Having little programming experience, a simple task like executing the script was trowing me off. Where do I execute? In LightWave or in PyCharm. This simple logic wasn't obvious at first and than I finally understood what this script was doing and it should be executed from within Layout.

For those who knows nothing about LWPython, like myself this is how i got it working.

01) I'm on a mac.
In Layout I go to Utilities > Python

02) The file browser opens and I navigate to the generate_interface folder where the two python files are: generate_interface.py and generate_pi.py. You can find the script in this forum thread.

03) I chose the generate_interface.py and clicked open.

04) The Generate Python Interfaces window pops up.

05) The destination folder where the generated files will be stored must be selected. In my case /Library/Python/2.7/site-packages

06) I press OK

07) I get an error message [ IOError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/lwsdk.py']

08) At this moment I don't have permission to write to this location just yet.

09) I go to the folder:/Library/Python/2.7/site-packages and I select the folder site-packages and press the keyboard shortcut [cmd i]. This opens the info panel for this folder.

10) I go to the 'Permissions' dropdown and temporarily change this folder to be writable code 775

11) I repeat steps 1 to 6 and than the files are generated and saved in the site-packages folder.

12) I set the "Permission" of the site-packages folder (step 10) back to it's original state code 755

13) If everything went as planned i can now use the autocompletion in PyCharm for my LightWave Python scripting.

Hope this helps anyone new to anything Lightwave and Python who are as clueless as I was.