Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD

Post by Kunda1 »

I'm finding the internal python editor / macro editor to be inferior to my preferable GUI text editor which is Atom. I'd like to see a screencast of someone using an external editor to control FreeCAD GUI.

An aside: it's very cool to see how blender is getting there internal text editor updated in these latest releases. I'll post some links when I have a moment. Very impressive.
Example:
https://mobile.twitter.com/rintworin/st ... 8291027968
https://mobile.twitter.com/rintworin/st ... 0670795776
https://mobile.twitter.com/rintworin/st ... 8063867904
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
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD

Post by Kunda1 »

anyone?
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
Cyril
Posts: 133
Joined: Wed Aug 23, 2017 5:04 pm
Location: Geneva (Switzerland)
Contact:

Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD

Post by Cyril »

I will do one but I'm currently overflowed. Maybe a short one next week end.
I blog about HVAC / BIM / Energy : pythoncvc.net. If you like you can follow the RSS feed.
Cyril
Posts: 133
Joined: Wed Aug 23, 2017 5:04 pm
Location: Geneva (Switzerland)
Contact:

Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD

Post by Cyril »

I am not sure that it is what you expected to see after I read your message again but here it is :
phpBB [video]


Fact is that there is many discussion on this subject on this forum but none I found explains a way to catch and control a running FreeCAD instance as you can do with for example Libre Office from python.
I blog about HVAC / BIM / Energy : pythoncvc.net. If you like you can follow the RSS feed.
Bayesian
Posts: 90
Joined: Thu Aug 08, 2019 1:49 pm

Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD

Post by Bayesian »

You could use FreeCAD from Jupyter notebook, but then you have to start the FreeCAD application in there, also. It gives you very nice interactive and pythonic control over FC, though.

I have another Forum post where I describe how to put an asyncio event loop into the FreeCAD app. You could run an HTTP Server, like FastAPI or just aiohttp, and execute Python scripts from POST requests. Then you can write a simple script to "remotely inject" a script.
Bayesian
Posts: 90
Joined: Thu Aug 08, 2019 1:49 pm

Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD

Post by Bayesian »

And for Blender scripting, I actually recommend to create python packages, and start blender from scratch each time you change the code. The problem is that Blender tends to accumulate "state" and it's important to make sure the scripts work from scratch or at least from known blend files.

Of course, I also implemented a Jupyter kernel and an asyncio event loop for Blender....
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD

Post by Kunda1 »

Great job on this clip. I had no idea about .env files. I need to explore this further.
I'm still going through the clip a little piece at a time.

Noteworthy: App:Part documentation doesn't show up in the editor. Wonder what that is about?
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
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD

Post by Kunda1 »

Cyril wrote: Mon Nov 11, 2019 12:09 am
phpBB [video]
What page on the wiki should we add this to?
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
Cyril
Posts: 133
Joined: Wed Aug 23, 2017 5:04 pm
Location: Geneva (Switzerland)
Contact:

Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD

Post by Cyril »

Kunda1 wrote: Mon Dec 30, 2019 3:58 pm What page on the wiki should we add this to?
I have described a part of it in Debugging. Maybe a specific page should be created like «Setup your IDE» which will contain guidance for common IDEs.
I blog about HVAC / BIM / Energy : pythoncvc.net. If you like you can follow the RSS feed.
Cyril
Posts: 133
Joined: Wed Aug 23, 2017 5:04 pm
Location: Geneva (Switzerland)
Contact:

Re: Please demonstrate using a remote text editor to substitute the Python editor in FreeCAD

Post by Cyril »

I have updated my article with enhanced auto-completion using freecad-stubs.
I blog about HVAC / BIM / Energy : pythoncvc.net. If you like you can follow the RSS feed.
Post Reply