Awesome!Cyril wrote: ↑Sun Oct 04, 2020 3:33 pm I have updated my article with enhanced auto-completion using freecad-stubs.
Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD
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
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
Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD
Based on Cyril's explanation, I wanted to add Windows version. I have seen a few different questions from Windows perspective. I will try to keep as generic as possible in terms of folder representation. As Cyril explained in the video, create .env file and include the followings in .env file.
That said the project parent folder is the same location as the FreeCAD_0.19.22522 AppImage (Conda binary). Therefore, I have ../ structure in .env. Alternatively, you can write the lines below. Here, <WHEREVER YOU HAVE YOUR FREECAD> is the installation location.
I included stubs after downloading zip file from GitHub and opening the archive in FreeCAD installation folder as /freecad-stubs. In Windows 10, while writing PYTHONPATH you need to use ; instead of : . After adding .env file you need to restart VS Code.
I also use .vscode/settings.json for my project folder.
In settings.json, you see that I have /src folder in which I keep my python scripts and modules that I developed. Having settings.json is not a must unless you would like to keep your developed python code -or module- in a separate folder.
Thank you Cyril for the video.
Code: Select all
FREECAD_LIB=../FreeCAD_0.19.22522/lib
FREECAD_MOD=../FreeCAD_0.19.22522/Mod
FREECAD_STUBS=../FreeCAD_0.19.22522/freecad-stubs/out
PYTHONPATH=${FREECAD_STUBS};${FREECAD_Mod};${FREECAD_LIB};${PYTHONPATH}
Code: Select all
FREECAD_LIB=C:\\<WHEREVER YOU HAVE YOUR FREECAD>\\FreeCAD_0.19.22522\\lib
FREECAD_MOD=C:\\<WHEREVER YOU HAVE YOUR FREECAD>\\FreeCAD_0.19.22522\\Mod
FREECAD_STUBS=C:\\<WHEREVER YOU HAVE YOUR FREECAD>\\FreeCAD_0.19.22522\\freecad-stubs/out
PYTHONPATH=${FREECAD_STUBS};${FREECAD_Mod};${FREECAD_LIB};${PYTHONPATH}
I also use .vscode/settings.json for my project folder.
Code: Select all
{
"terminal.integrated.env.windows": {
"PYTHONPATH": "${env:PYTHONPATH};${workspaceFolder}/src",
},
"python.envFile": "${workspaceFolder}/.env"
}
Thank you Cyril for the video.
Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD
I started modifying the grbl post yesterday in VS Code. I like linting and the modified file gets read each time I run it in Path.
But, i definitely need to find the forum post about setting up for debugging. Would be nice to be able to checkout variables at runtime.
But, i definitely need to find the forum post about setting up for debugging. Would be nice to be able to checkout variables at runtime.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD
You are in the right thread (see previous posts)drmacro wrote: ↑Wed Oct 07, 2020 10:43 am I started modifying the grbl post yesterday in VS Code. I like linting and the modified file gets read each time I run it in Path.
But, i definitely need to find the forum post about setting up for debugging. Would be nice to be able to checkout variables at runtime.
I am still using ptvsd but yesterday I saw that vscode has a new debugger called debugpy. I am currently looking at it to debug Blender addons.
I blog about HVAC / BIM / Energy : pythoncvc.net. If you like you can follow the RSS feed.
Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD
I've added the python and json code as specified in the FC wiki: https://wiki.freecadweb.org/Debugging
But, am still confused about a couple things.
- what is the sequence to make the connection between FC and VSCode debugger.
- VSCode basically won't do anything because it knows not where "import FreeCAD" module resides, thus can't import.
But, am still confused about a couple things.
- what is the sequence to make the connection between FC and VSCode debugger.
- VSCode basically won't do anything because it knows not where "import FreeCAD" module resides, thus can't import.
Star Trek II: The Wrath of Khan: Spock: "...His pattern indicates two-dimensional thinking."
Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD
Here is a video showing debugging FreeCAD Python macros with Visual Studio Code with all the set up that is needed. Very simple. You can even use the debugger to edit the code but I am not sure how useful it is.
PTVSD is required and is available here.
pip install ptvsd
PTVSD is required and is available here.
pip install ptvsd
Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD
Moved to Python forum - finally.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD
Following posts were split to a new topic.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD
reupping this topic. I never got closure on this.
Note: there is alnso's effort to incorporate KTextEditor https://github.com/Alonso-JAMM/FreeCAD_KTextEditor
Note: there is alnso's effort to incorporate KTextEditor https://github.com/Alonso-JAMM/FreeCAD_KTextEditor
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
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