Using PyCharm as editor
Using PyCharm as editor
I want to use PyCharm as an editor.
How do I get rid of the errors? I cannot figure out how to add FreeCAD as an exernal library in PyCharm.
Any help appreciated.
Mårten
PyCharm is:
PyCharm Community Edition 5.0.4
Build #PC-143.1919, built on January 28, 2016
JRE: 1.8.0_51-b16 x86
JVM: Java HotSpot(TM) Server VM by Oracle Corporation
FreeCAD is:
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6634 (Git)
Build type: Release
Branch: master
Hash: 297e84e3f064356d2a3403345e83a454a7eea923
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
How do I get rid of the errors? I cannot figure out how to add FreeCAD as an exernal library in PyCharm.
Any help appreciated.
Mårten
PyCharm is:
PyCharm Community Edition 5.0.4
Build #PC-143.1919, built on January 28, 2016
JRE: 1.8.0_51-b16 x86
JVM: Java HotSpot(TM) Server VM by Oracle Corporation
FreeCAD is:
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.16.6634 (Git)
Build type: Release
Branch: master
Hash: 297e84e3f064356d2a3403345e83a454a7eea923
Python version: 2.7.8
Qt version: 4.8.6
Coin version: 4.0.0a
Point taken 

Re: Using PyCharm as editor
I have downloaded PyCharm and when running it the very first time you have to define the path to the Python interpreter. If you define the path to the python.exe of the FreeCAD installation then using the FreeCAD module seems to work fine.
Re: Using PyCharm as editor
I installed the FreeCAD python as project interpreter. Still got plenty of errors.
Point taken 

Re: Using PyCharm as editor
Now I have an ubuntu based setup. I still cannot figure out how to edit python files in PyCharm. I have added /usr/lib/freecad/Mod as a Content Root.
OS: Ubuntu 16.04 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4671 (Git)
Branch: releases/FreeCAD-0-15
Hash: 244b3aef360841646cbfe80a1b225c8b39c8380c
Python version: 2.7.11
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
PyCharm Community Edition 2016.2
Build #PC-162.1237.1, built on July 20, 2016
JRE: 1.8.0_76-release-b216 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
OS: Ubuntu 16.04 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.15.4671 (Git)
Branch: releases/FreeCAD-0-15
Hash: 244b3aef360841646cbfe80a1b225c8b39c8380c
Python version: 2.7.11
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
PyCharm Community Edition 2016.2
Build #PC-162.1237.1, built on July 20, 2016
JRE: 1.8.0_76-release-b216 amd64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Point taken 

Re: Using PyCharm as editor
I haven’t used PyCharm Community in a while, but this is how I configured my project settings to be able to import the FreeCAD modules.
Open your PyCharm project then select File -> Settings In the settings dialog, expand the Project:<name of project> and select "Project Structure"
In the far right column select "+ Add Content Root" and navigate the folder you want.
On my system the folder is "/usr/lib/freecad-daily/lib", yours may be different. Hope this helps.
Sal
OS: Ubuntu 16.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.8054 (Git)
Build type: None
Branch: master
Hash: 8fe7c94452e4a5f083162e6ff004d3575878c546
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Open your PyCharm project then select File -> Settings In the settings dialog, expand the Project:<name of project> and select "Project Structure"
In the far right column select "+ Add Content Root" and navigate the folder you want.
On my system the folder is "/usr/lib/freecad-daily/lib", yours may be different. Hope this helps.
Sal
OS: Ubuntu 16.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.8054 (Git)
Build type: None
Branch: master
Hash: 8fe7c94452e4a5f083162e6ff004d3575878c546
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Re: Using PyCharm as editor
Thanks Sal
This is exactly what I have done. But I still get "No module named Part" and "Unresolved reference FreeCAD".
I have tried
This is exactly what I have done. But I still get "No module named Part" and "Unresolved reference FreeCAD".
I have tried
Code: Select all
/usr/lib/freecad-daily
/usr/lib/freecad-daily/lib
/usr/lib/freecad-daily/bin
/usr/lib/freecad-daily/Mod
Point taken 

Re: Using PyCharm as editor
Marten,
Are you trying to run the code inside PyCharm?
I only ask because I have run into issues were the code is not executed consistently.
For example the code in the screen shot runs in debug mode, but if I create a new file it cant even find the FreeCAD source.
Have you looked Eclipse with the PyDev add in? I'm going to give it a shot and see if its any easier to configure.
Please keep us up to date, I think many people would like to see how to utilize an IDE to develop FreeCAD code.
Sal
Are you trying to run the code inside PyCharm?
I only ask because I have run into issues were the code is not executed consistently.
For example the code in the screen shot runs in debug mode, but if I create a new file it cant even find the FreeCAD source.
Have you looked Eclipse with the PyDev add in? I'm going to give it a shot and see if its any easier to configure.
Please keep us up to date, I think many people would like to see how to utilize an IDE to develop FreeCAD code.
Sal
Re: Using PyCharm as editor
Thanks Sal
I am just trying to use PyCharm as editor. It doesn't work with version 0.15 or 0.17. My current version is;
Mårten
I am just trying to use PyCharm as editor. It doesn't work with version 0.15 or 0.17. My current version is;
Code: Select all
OS: Ubuntu 16.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.8020 (Git)
Build type: None
Branch: master
Hash: 62a8828dc8603a9387a5fa1d9eb41bc4cf12cb62
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Mårten
Point taken 

Re: Using PyCharm as editor
Marten,
I just want to clarify that i understand your question. You want to use PyCharm editor and configure it so that it shows you what is available inside the module that has been imported. First I wanted to mention that I was NOT able to configure PyCharm to work, however I went away and did a little research and found that Eclipse with PyDev works.
I installed the IDE including the PyDev module and then created a new project as shown in the next 3 images. Finally I created a file and entered 2 lines of code
import FreeCAD
FreeCAD.
After you enter the dot, the window opens and shows all the functions inside the FreeCAD module.
Is this what you were expecting?
OS: Ubuntu 16.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.8066 (Git)
Build type: None
Branch: master
Hash: 4de1b39b4f428200241f726fe32d77a1f6bcc30a
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Sal
I just want to clarify that i understand your question. You want to use PyCharm editor and configure it so that it shows you what is available inside the module that has been imported. First I wanted to mention that I was NOT able to configure PyCharm to work, however I went away and did a little research and found that Eclipse with PyDev works.
I installed the IDE including the PyDev module and then created a new project as shown in the next 3 images. Finally I created a file and entered 2 lines of code
import FreeCAD
FreeCAD.
After you enter the dot, the window opens and shows all the functions inside the FreeCAD module.
Is this what you were expecting?
OS: Ubuntu 16.04.1 LTS
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.17.8066 (Git)
Build type: None
Branch: master
Hash: 4de1b39b4f428200241f726fe32d77a1f6bcc30a
Python version: 2.7.12
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 6.8.0.oce-0.17
Sal