Best working external IDE to import FreeCAD in 2021

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!
drmacro
Veteran
Posts: 8870
Joined: Sun Mar 02, 2014 4:35 pm

Re: Best working external IDE to import FreeCAD in 2021

Post by drmacro »

heda wrote: Sat Jul 24, 2021 3:57 pm if installing icecream, that lies inbetween a simple print and python built in log/pdb.
Nice!

The thing that makes the vscode thing work for me is being able to single step and the ability to watch values, objects (and their properties) change as I step the code.

Also, while single stepping, being able to browse all the objects (as in code objects) while stepping gives a lot of insight into the structure of the document/model. And, since you can type, while in single step/breakpoint, for example FreeCAD.ActiveDocument... and walk the object to peruse it or to discover the correct syntax to use in your code can be very useful.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: Best working external IDE to import FreeCAD in 2021

Post by heda »

indeed, as said - for myself I do just fine without a stepping debugger, explorations of objects I do directly in fc console as smaller testcases to see how it works, and then code in an external editor not linked to fc. for me I can live perfectly without it in terms of fc, and if I do any type of other coding, I find myself leaning towards simple print statements anyways - it is often quicker compared to breakpoints and steppings, but that does not mean that I sometimes use it, most of the time it would be in some sort of looping involved, or figure out why a function call that "should be made" is not.

just trying to point out that having an ide hooked up to fc is not the holy grail to be able to code for fc that some might believe,
given that "code" is python only (for the c part, which I do not do, I assume that would be a bit harder without a complete dev environment)
Last edited by heda on Sat Jul 24, 2021 6:26 pm, edited 1 time in total.
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Best working external IDE to import FreeCAD in 2021

Post by TheMarkster »

I use Visual Studio 2019 Community edition for python coding/debugging in FreeCAD. There is no preview of the object, but the debugging works very well. For the c++ stuff I do inside a virtualbox virtual machine running Ubuntu as a guest. I use QtCreator for coding/debugging.
superson1c
Posts: 4
Joined: Fri Jul 23, 2021 9:53 pm

Re: Best working external IDE to import FreeCAD in 2021

Post by superson1c »

Hi all,

thank you all for the nice discussion, your insights and recommendations.
I will write the code in PyCharm, then copy/paste and run it as macro in FreeCAD. I will use pip install and try to reduce the used python libraries as much as possible.

Cheers
superson1c
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: Best working external IDE to import FreeCAD in 2021

Post by heda »

no need to copy paste...

in python console,

Code: Select all

App.getUserMacroDir()
gives you the location of macros.
just save the file there as a .py file (or the usual .FCMacro, but then you have to care for the syntax highlighting in the ide)
then you have menu macro/recent macros making it easy to rerun a macro
TheMarkster
Veteran
Posts: 5505
Joined: Thu Apr 05, 2018 1:53 am

Re: Best working external IDE to import FreeCAD in 2021

Post by TheMarkster »

heda wrote: Sun Jul 25, 2021 3:27 pm no need to copy paste...

in python console,

Code: Select all

App.getUserMacroDir()
gives you the location of macros.
just save the file there as a .py file (or the usual .FCMacro, but then you have to care for the syntax highlighting in the ide)
then you have menu macro/recent macros making it easy to rerun a macro
I was able to tell Visual Studio that .FCMacro files were python, so it handles the syntax highlighting. Alternatively, you can name the macro to have a .py extension and it will work just fine. For example> my_macro.FCMacro.py will work as a macro and your IDE will be able to do the syntax highlighting.
drmacro
Veteran
Posts: 8870
Joined: Sun Mar 02, 2014 4:35 pm

Re: Best working external IDE to import FreeCAD in 2021

Post by drmacro »

TheMarkster wrote: Sun Jul 25, 2021 4:28 pm ...
I was able to tell Visual Studio that .FCMacro files were python, so it handles the syntax highlighting. Alternatively, you can name the macro to have a .py extension and it will work just fine. For example> my_macro.FCMacro.py will work as a macro and your IDE will be able to do the syntax highlighting.
Yeah, you can do that in vscode as well.

I just don't see the point of retaining the FCMacro extension, either in my code or on the part of FreeCAD. Just call them .py and be done with it. :roll:
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Syres
Veteran
Posts: 2893
Joined: Thu Aug 09, 2018 11:14 am

Re: Best working external IDE to import FreeCAD in 2021

Post by Syres »

heda wrote: Sun Jul 25, 2021 3:27 pm in python console,

Code: Select all

App.getUserMacroDir()
gives you the location of macros.
Sorry to be pedantic but the exact code is:

Code: Select all

App.getUserMacroDir(True)
If I used your code I would get the default folder for macros not that actual one in use which I have set in a custom folder.
heda
Veteran
Posts: 1348
Joined: Sat Dec 12, 2015 5:49 pm

Re: Best working external IDE to import FreeCAD in 2021

Post by heda »

Syres wrote: Sun Jul 25, 2021 5:00 pm Sorry to be pedantic...
:lol: no worries, and we are all here to learn, keep them coming - I have no problems in being corrected :D

ps: had to explore the possible escape route that it was not visible in the console as help text, but when checking that - it was clearly stated there
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Best working external IDE to import FreeCAD in 2021

Post by Kunda1 »

subscribing to this topic
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Post Reply