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

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
User avatar
Kunda1
Posts: 5761
Joined: Thu Jan 05, 2017 9:03 pm

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

Postby Kunda1 » Tue Nov 05, 2019 5:44 pm

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
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Kunda1
Posts: 5761
Joined: Thu Jan 05, 2017 9:03 pm

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

Postby Kunda1 » Wed Nov 06, 2019 4:50 pm

anyone?
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
Cyril
Posts: 70
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

Postby Cyril » Wed Nov 06, 2019 7:12 pm

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.
User avatar
Cyril
Posts: 70
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

Postby Cyril » Mon Nov 11, 2019 12:09 am

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: 41
Joined: Thu Aug 08, 2019 1:49 pm

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

Postby Bayesian » Mon Nov 11, 2019 4:33 pm

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: 41
Joined: Thu Aug 08, 2019 1:49 pm

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

Postby Bayesian » Mon Nov 11, 2019 4:39 pm

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....