Accessing FreeCAD using an external IDE

Post here for help on using FreeCAD's graphical user interface (GUI).
Forum rules
and Helpful information
IMPORTANT: Please click here and read this first, before asking for help

Also, be nice to others! Read the FreeCAD code of conduct!
chenkianwee
Posts: 27
Joined: Tue Jul 06, 2010 7:46 am

Accessing FreeCAD using an external IDE

Post by chenkianwee »

I would like to access FreeCAD with an external IDE like eric , so instead of scripting in the python console window i will be able to have an external editor ?
how do i set it ?

thanks
kianwee
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Accessing FreeCAD using an external IDE

Post by jriegel »

If the gui is not up, its easy. Just load FreeCAD as python module.

With the gui up its bit more complicated. Because the event loop is runing.
That means the control gets allways from the event loop to the script.

Werner experimented a bit with such set ups I think....

We could think of some kind of socket we open in FreeCAD which recive
scripting commands and feed it into the event loop. But thats also a big
security hole... :(
Stop whining - start coding!
chenkianwee
Posts: 27
Joined: Tue Jul 06, 2010 7:46 am

Re: Accessing FreeCAD using an external IDE

Post by chenkianwee »

yup i tried without the gui and it is working well. hmnnn .... just have to settle for the no gui first or just script in the python console . thanks
wmayer
Founder
Posts: 19963
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Accessing FreeCAD using an external IDE

Post by wmayer »

chenkianwee
Posts: 27
Joined: Tue Jul 06, 2010 7:46 am

Re: Accessing FreeCAD using an external IDE

Post by chenkianwee »

I am trying to write a freecad function with an external IDE eclipse , I have appended the path /usr/lib/freecad/lib , /usr/lib/freecad/mod, /usr/lib/freecad/mod/Part
hoping to get the autocompletion of the various functions and module of freecad. However, it doesnt seem to be working properly. attached below is a screenshot of the autocomplete in eclipse it seems to give me some weird function instead of the normal makeBox() function that i wanted .
Attachments
Screenshot-1.jpg
Screenshot-1.jpg (121.3 KiB) Viewed 5196 times
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Accessing FreeCAD using an external IDE

Post by jriegel »

The question is what can we do about it? Its a question for Eclipse....
Stop whining - start coding!
wmayer
Founder
Posts: 19963
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Accessing FreeCAD using an external IDE

Post by wmayer »

It seems that this is not the FreeCAD Part module. What module path is displayed when doing a "print Part"?
chenkianwee
Posts: 27
Joined: Tue Jul 06, 2010 7:46 am

Re: Accessing FreeCAD using an external IDE

Post by chenkianwee »

I somehow manage to solve it i guess. so instead of :
import Part
i did :
from FreeCAD import Part


but the autocompletion is still shaky, for e.g. the autocompletion does not work for the Base module and also for the topological data:


Just wondering anyone went thru this issue before. thanks anyway
Attachments
Screenshot.jpg
Screenshot.jpg (131.82 KiB) Viewed 5186 times
wmayer
Founder
Posts: 19963
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Accessing FreeCAD using an external IDE

Post by wmayer »

Maybe Eclipse doesn't like it that you set the sys.path inside the script in order to load FreeCAD there. I guess there must be a way where you can set permanently the path to FreeCAD inside the IDE.
User avatar
Bad Blue Bull
Posts: 9
Joined: Mon Aug 26, 2019 12:22 pm

Re: Accessing FreeCAD using an external IDE

Post by Bad Blue Bull »

jriegel wrote: Tue Jul 06, 2010 8:35 am If the gui is not up, its easy. Just load FreeCAD as python module.

With the gui up its bit more complicated. Because the event loop is runing.
That means the control gets allways from the event loop to the script.

Werner experimented a bit with such set ups I think....

We could think of some kind of socket we open in FreeCAD which recive
scripting commands and feed it into the event loop. But thats also a big
security hole... :(
Yeah, please I'd like it very much. Simple thing that I want: I use Emacs to write a script file, then send a command to FreeCAD to import this script.
Socket can be closed by default, no problem there.
x64, Slackware 14.2, Linux 4.4.38.
Post Reply