what IDE do you use

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
jrheinlaender
Posts: 554
Joined: Sat Apr 07, 2012 2:42 am

Re: what IDE do you use

Post by jrheinlaender »

I installed eric4 on Ubuntu 12.04 and ran this in the console:

Code: Select all

Python 2.7.3 (default, Aug  1 2012, 05:16:07) 
[GCC 4.6.3] auf jan-laptop, Standard
>>> import sys
>>> sys.path.append(".../freecad-build-dbg/lib")
>>> import FreeCADGui
>>> FreeCADGui.showMainWindow()
StdErr: Main window restored
StdErr: Show main window
Toolbars restored
>>> 
no crashes, but I don't get to see a main window either :-(
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: what IDE do you use

Post by jriegel »

wmayer wrote: One further oddity:
If I use FreeCAD compiled with cmake I have all this trouble but not when using it compiled with automake.
Uhh, thats not good.. Do we have different compile switches or different libs with a different build system?
The plan was to abandon configure with the 0.14....
Stop whining - start coding!
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: what IDE do you use

Post by wmayer »

After changing the implementation of Base::Uuid to use Qt's instead of Python's implementation seems to have completely fixed the trouble.
no crashes, but I don't get to see a main window either
Maybe you have to explicitly start the event loop doing:

Code: Select all

FreeCADGui.exec_loop()
jrheinlaender
Posts: 554
Joined: Sat Apr 07, 2012 2:42 am

Re: what IDE do you use

Post by jrheinlaender »

Maybe you have to explicitly start the event loop doing:
Great! That did it.

Next issue is that when I start my custom python feature, I get:

Failed to load UI file from 'Mod/PartDesign/FeatureBore/TaskBore.ui'

The path works fine when I run FC from the command line. What do I need to add so that it will be found when I start FC from eric4?
jonasthomas
Posts: 162
Joined: Wed Feb 01, 2012 3:29 am

Re: what IDE do you use

Post by jonasthomas »

jrheinlaender wrote:
Maybe you have to explicitly start the event loop doing:
Great! That did it.

Next issue is that when I start my custom python feature, I get:

Failed to load UI file from 'Mod/PartDesign/FeatureBore/TaskBore.ui'

The path works fine when I run FC from the command line. What do I need to add so that it will be found when I start FC from eric4?
Can you post what you did?
I did this and I was getting complaints... Is this what you did, (well except for the link to the libraries)

Code: Select all

#test.py

#this is a test routine to get run freecad entirely from the eric4 ide
import sys
# This is the standard location for the libraries in ubuntu.
#sys.path.append("/usr/lib/freecad/lib/")

#jonas thomas has his debug libraries here.
sys.path.append("/home/jonas/freecad/qtcreator-build/lib")

# jrheinlaender has his debug libary here.
#sys.path.append(".../freecad-build-dbg/lib")

import FreeCADGui
FreeCADGui.exec_loop()
FreeCADGui.showMainWindow()
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: what IDE do you use

Post by wmayer »

The path works fine when I run FC from the command line. What do I need to add so that it will be found when I start FC from eric4?
This has something to do with the current working directory. The path you have in your script is a relative one and thus it depends on what the working directory is whether it works or not.

You should use an absolute path and this thread should give you an idea how: viewtopic.php?f=3&t=3371
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: what IDE do you use

Post by wmayer »

Which complaints?
import FreeCADGui
FreeCADGui.exec_loop()
FreeCADGui.showMainWindow()
The last two lines must be flipped.
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: what IDE do you use

Post by wmayer »

Now to come back to the original question of this thread. I tried out Eclipse + pydev on Windows and it works pretty well. It is possible to use the remote debugger of pydev and use it from within the FreeCAD application.
First, for a proper installation of pydev follow the instructions here and here

And here you'll find out how to do remote debugging.
In short: the idea is to run the debug server and add a code snippet to the script that connects FreeCAD as client to the debug server. Then run the script from within FreeCAD.
In Eclipse you'll see the script file running in FreeCAD which you can open and debug step by step. You can also observe any defined variables.
The only important point of course is that the script must be saved in a file, i.e. you cannot use FreeCAD's built-in Python console.

Btw, Eric also provides a remote debugging facility and it basically works the same way.
jonasthomas
Posts: 162
Joined: Wed Feb 01, 2012 3:29 am

Re: what IDE do you use

Post by jonasthomas »

wmayer wrote:Which complaints?
import FreeCADGui
FreeCADGui.exec_loop()
FreeCADGui.showMainWindow()
The last two lines must be flipped.
Ok. This is what I'm trying now.

Code: Select all

#test.py

#this is a test routine to get run freecad entirely from the eric4 ide
import sys
# This is the standard location for the libraries in ubuntu.
#sys.path.append("/usr/lib/freecad/lib/")

#jonas thomas has his debug libraries here.
sys.path.append("/home/jonas/freecad/qtcreator-build/lib")

# jrheinlaender has his debug libary here.
#sys.path.append(".../freecad-build-dbg/lib")

import FreeCADGui
FreeCADGui.showMainWindow()
FreeCADGui.exec_loop()
[/code]

Image
if not hasattr(FreeCAD,"DraftWorkingPlane"):
import WorkingPlane, Draft_rc
FreeCAD.DraftWorkingPlane = WorkingPlane.plane()
print FreeCAD.DraftWorkingPlane
FreeCADGui.addIconPath(":/icons")
Initially I thought the :/icons was the issue but I believe that the crash is on the bolded line.

Code: Select all


jonas@jonas-laptop:~/freecad$ locate *freecad*.so
/home/jonas/freecad/qtcreator-build/Mod/Assembly/Assembly.so
/home/jonas/freecad/qtcreator-build/Mod/Assembly/AssemblyGui.so
/home/jonas/freecad/qtcreator-build/Mod/Complete/Complete.so
/home/jonas/freecad/qtcreator-build/Mod/Complete/CompleteGui.so
/home/jonas/freecad/qtcreator-build/Mod/Drawing/Drawing.so
/home/jonas/freecad/qtcreator-build/Mod/Drawing/DrawingGui.so
/home/jonas/freecad/qtcreator-build/Mod/Fem/Fem.so
/home/jonas/freecad/qtcreator-build/Mod/Fem/FemGui.so
/home/jonas/freecad/qtcreator-build/Mod/Image/Image.so
/home/jonas/freecad/qtcreator-build/Mod/Image/ImageGui.so
/home/jonas/freecad/qtcreator-build/Mod/Import/ImportGui.so
/home/jonas/freecad/qtcreator-build/Mod/Inspection/Inspection.so
/home/jonas/freecad/qtcreator-build/Mod/Inspection/InspectionGui.so
/home/jonas/freecad/qtcreator-build/Mod/Mesh/Mesh.so
/home/jonas/freecad/qtcreator-build/Mod/Mesh/MeshGui.so
/home/jonas/freecad/qtcreator-build/Mod/MeshPart/MeshPart.so
/home/jonas/freecad/qtcreator-build/Mod/MeshPart/MeshPartGui.so
/home/jonas/freecad/qtcreator-build/Mod/Part/Part.so
/home/jonas/freecad/qtcreator-build/Mod/Part/PartGui.so
/home/jonas/freecad/qtcreator-build/Mod/PartDesign/PartDesign.so
/home/jonas/freecad/qtcreator-build/Mod/PartDesign/PartDesignGui.so
/home/jonas/freecad/qtcreator-build/Mod/Points/Points.so
/home/jonas/freecad/qtcreator-build/Mod/Points/PointsGui.so
/home/jonas/freecad/qtcreator-build/Mod/Raytracing/Raytracing.so
/home/jonas/freecad/qtcreator-build/Mod/Raytracing/RaytracingGui.so
/home/jonas/freecad/qtcreator-build/Mod/ReverseEngineering/ReverseEngineering.so
/home/jonas/freecad/qtcreator-build/Mod/ReverseEngineering/ReverseEngineeringGui.so
/home/jonas/freecad/qtcreator-build/Mod/Robot/Robot.so
/home/jonas/freecad/qtcreator-build/Mod/Robot/RobotGui.so
/home/jonas/freecad/qtcreator-build/Mod/Sketcher/Sketcher.so
/home/jonas/freecad/qtcreator-build/Mod/Sketcher/SketcherGui.so
/home/jonas/freecad/qtcreator-build/Mod/Start/Start.so
/home/jonas/freecad/qtcreator-build/Mod/Start/StartGui.so
/home/jonas/freecad/qtcreator-build/Mod/Test/QtUnitGui.so
/home/jonas/freecad/qtcreator-build/Mod/Web/WebGui.so
/home/jonas/freecad/qtcreator-build/bin/pivy/_coin.so
/home/jonas/freecad/qtcreator-build/bin/pivy/gui/_soqt.so
/home/jonas/freecad/qtcreator-build/lib/FreeCAD.so
/home/jonas/freecad/qtcreator-build/lib/FreeCADGui.so
/home/jonas/freecad/qtcreator-build/lib/libDriver.so
/home/jonas/freecad/qtcreator-build/lib/libDriverDAT.so
/home/jonas/freecad/qtcreator-build/lib/libDriverSTL.so
/home/jonas/freecad/qtcreator-build/lib/libDriverUNV.so
/home/jonas/freecad/qtcreator-build/lib/libFreeCADApp.so
/home/jonas/freecad/qtcreator-build/lib/libFreeCADBase.so
/home/jonas/freecad/qtcreator-build/lib/libFreeCADGui.so
/home/jonas/freecad/qtcreator-build/lib/libSMDS.so
/home/jonas/freecad/qtcreator-build/lib/libSMESH.so
/home/jonas/freecad/qtcreator-build/lib/libSMESHDS.so
/home/jonas/freecad/qtcreator-build/lib/libStdMeshers.so
/usr/lib/freecad/Mod/PartDesign/PartDesign.so
/usr/lib/freecad/Mod/PartDesign/PartDesignGui.so
/usr/lib/freecad/lib/Assembly.so
/usr/lib/freecad/lib/AssemblyGui.so
/usr/lib/freecad/lib/Complete.so
/usr/lib/freecad/lib/CompleteGui.so
/usr/lib/freecad/lib/Drawing.so
/usr/lib/freecad/lib/DrawingGui.so
/usr/lib/freecad/lib/Fem.so
/usr/lib/freecad/lib/FemGui.so
/usr/lib/freecad/lib/FreeCAD.so
/usr/lib/freecad/lib/FreeCADGui.so
/usr/lib/freecad/lib/Image.so
/usr/lib/freecad/lib/ImageGui.so
/usr/lib/freecad/lib/ImportGui.so
/usr/lib/freecad/lib/Inspection.so
/usr/lib/freecad/lib/InspectionGui.so
/usr/lib/freecad/lib/Mesh.so
/usr/lib/freecad/lib/MeshGui.so
/usr/lib/freecad/lib/MeshPart.so
/usr/lib/freecad/lib/MeshPartGui.so
/usr/lib/freecad/lib/Part.so
/usr/lib/freecad/lib/PartGui.so
/usr/lib/freecad/lib/Points.so
/usr/lib/freecad/lib/PointsGui.so
/usr/lib/freecad/lib/QtUnitGui.so
/usr/lib/freecad/lib/Raytracing.so
/usr/lib/freecad/lib/RaytracingGui.so
/usr/lib/freecad/lib/ReverseEngineering.so
/usr/lib/freecad/lib/ReverseEngineeringGui.so
/usr/lib/freecad/lib/Robot.so
/usr/lib/freecad/lib/RobotGui.so
/usr/lib/freecad/lib/Sketcher.so
/usr/lib/freecad/lib/SketcherGui.so
/usr/lib/freecad/lib/Start.so
/usr/lib/freecad/lib/StartGui.so
/usr/lib/freecad/lib/WebGui.so
/usr/lib/freecad/lib/libDriver.so
/usr/lib/freecad/lib/libDriverDAT.so
/usr/lib/freecad/lib/libDriverSTL.so
/usr/lib/freecad/lib/libDriverUNV.so
/usr/lib/freecad/lib/libFreeCADApp.so
/usr/lib/freecad/lib/libFreeCADBase.so
/usr/lib/freecad/lib/libFreeCADGui.so
/usr/lib/freecad/lib/libSMDS.so
/usr/lib/freecad/lib/libSMESH.so
/usr/lib/freecad/lib/libSMESHDS.so
/usr/lib/freecad/lib/libStdMeshers.so
jonas@jonas-laptop:~/freecad$ 

jonas@jonas-laptop:~/freecad$ locate DrawingGui.so
/home/jonas/freecad/qtcreator-build/Mod/Drawing/DrawingGui.so
/usr/lib/freecad/lib/DrawingGui.so
jonas@jonas-laptop:~/freecad$
Ok I think the problem is that I'm not picking up the library
import WorkingPlane because not all the so. files are in /home/jonas/freecad/qtcreator-build/lib/
So... I tried this.

Code: Select all

#test.py

#this is a test routine to get run freecad entirely from the eric4 ide
import sys
# This is the standard location for the libraries in ubuntu.
#sys.path.append("/usr/lib/freecad/lib/")

#jonas thomas has his debug libraries here.
sys.path.append("/home/jonas/freecad/qtcreator-build/lib/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Assembly/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Complete/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Drawing/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Fem/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Image/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Import/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Inspection/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Inspection/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Mesh/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/MeshPart/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Part/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/PartDesign/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Points/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Raytracing/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/ReverseEngineering/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Robot/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Sketcher/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Start/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Test/")
sys.path.append("/home/jonas/freecad/qtcreator-build/Mod/Web/")
sys.path.append("/home/jonas/freecad/qtcreator-build/bin/pivy/")
sys.path.append("/home/jonas/freecad/qtcreator-build/bin/pivy/gui/")



# jrheinlaender has his debug libary here.
#sys.path.append(".../freecad-build-dbg/lib")

import FreeCADGui
FreeCADGui.showMainWindow()
FreeCADGui.exec_loop()
I thought that would fix the crash but I still can't get past that line. Which .so file is workplane located in?
wmayer
Founder
Posts: 20241
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: what IDE do you use

Post by wmayer »

Ok I think the problem is that I'm not picking up the library
import WorkingPlane because not all the so. files are in /home/jonas/freecad/qtcreator-build/lib/
So... I tried this.
Don't worry about this. When running FreeCAD it goes through all sub-directories of Mod and adds them to sys.path automatically.
I thought that would fix the crash but I still can't get past that line. Which .so file is workplane located in?
Workplane comes somewhere from the Draft module. But you said you get a crash. Is it really a crash, i.e. you get a segmentation fault or something similar or is only an exception raised but FreeCAD is still working?
Post Reply