Starting and controlling FreeCAD from external console
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
-
- Posts: 48
- Joined: Wed Apr 17, 2019 7:42 pm
Starting and controlling FreeCAD from external console
Hi,
Does anyone know, if there is a way how to start FreeCAD with GUI, open a workbench, run some commands/MACRO from a python console or for example MATLAB?
I'd like to do some visualizations in FreeCAD based on computations from MATLAB/python/Julia script. The ideal would be to be able to control the GUI online from outside, but being able to start FreeCAD GUI, open a file and run a MACRO would be sufficient.
Thanks
Does anyone know, if there is a way how to start FreeCAD with GUI, open a workbench, run some commands/MACRO from a python console or for example MATLAB?
I'd like to do some visualizations in FreeCAD based on computations from MATLAB/python/Julia script. The ideal would be to be able to control the GUI online from outside, but being able to start FreeCAD GUI, open a file and run a MACRO would be sufficient.
Thanks
Re: Starting and controlling FreeCAD from external console
hi
maybe Embedding_FreeCAD for include FreeCAD ...
here command Python for execute FreeCAD
here for execute FreeCAD and the macro if the .FCMacro is associate to FreeCAD
mario
maybe Embedding_FreeCAD for include FreeCAD ...
here command Python for execute FreeCAD
Code: Select all
import os # executer un programme externe
os.startfile("C:/Program Files/FreeCAD 0.17/bin/FreeCAD.exe")
Code: Select all
import os # executer un programme externe
os.startfile("C:/Users/Your_User_name/AppData/Roaming/FreeCAD/Macro/Macro_Window_fonts_Single.FCMacro")
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
-
- Posts: 436
- Joined: Wed Sep 15, 2010 9:38 am
Re: Starting and controlling FreeCAD from external console
Ahoj,
you can either directly start FreeCAD (with GUI), IIRC with `FreeCAD macro_name.FCMacro` and use the full featured embedded Python console or use the FreeCAD kernel for Jupyter (https://github.com/looooo/jupyter_freecad_kernel) for a more pleasant interaction with Python.
For Matlab it can be more difficult but not impossible because some people already managed to interact with FreeCAD from Javascript though some server running within FreeCAD. I don't know anything ready for Matlab.
Cheers,
Gaël
you can either directly start FreeCAD (with GUI), IIRC with `FreeCAD macro_name.FCMacro` and use the full featured embedded Python console or use the FreeCAD kernel for Jupyter (https://github.com/looooo/jupyter_freecad_kernel) for a more pleasant interaction with Python.
For Matlab it can be more difficult but not impossible because some people already managed to interact with FreeCAD from Javascript though some server running within FreeCAD. I don't know anything ready for Matlab.
Cheers,
Gaël
Re: Starting and controlling FreeCAD from external console
numpy and matplotlib (both are python packages for numerical computing) should working with FreeCAD
Matplotlib isn't added by default i think. but some workbenches use it so it should be possible.
https://www.numpy.org
https://matplotlib.org
Matplotlib isn't added by default i think. but some workbenches use it so it should be possible.
https://www.numpy.org
https://matplotlib.org
-
- Posts: 48
- Joined: Wed Apr 17, 2019 7:42 pm
Re: Starting and controlling FreeCAD from external console
Thanks for help,
I found a way to do what I need using a custom workbench and a server.
I found a way to do what I need using a custom workbench and a server.
-
- Posts: 436
- Joined: Wed Sep 15, 2010 9:38 am
Re: Starting and controlling FreeCAD from external console
Nice! Glad you solved your problem. If your workbench is something general, could you consider sharing it and documenting its use?
Thanks,
Gaël
Thanks,
Gaël
-
- Posts: 48
- Joined: Wed Apr 17, 2019 7:42 pm
Re: Starting and controlling FreeCAD from external console
Hi, I just finished it - https://github.com/JiriValasek/Animate - this is it. The server tool does exactly what I wanted.galou_breizh wrote: ↑Mon Apr 29, 2019 7:08 pm Nice! Glad you solved your problem. If your workbench is something general, could you consider sharing it and documenting its use?
Thanks,
Gaël
- microelly2
- Veteran
- Posts: 4688
- Joined: Tue Nov 12, 2013 4:06 pm
- Contact:
Re: Starting and controlling FreeCAD from external console
Thank you for sharing this.JiriVALASEK wrote: ↑Thu Oct 10, 2019 6:53 am Hi, I just finished it - https://github.com/JiriValasek/Animate - this is it. The server tool does exactly what I wanted.
Re: Starting and controlling FreeCAD from external console
hi
good macro thank for sharing
for install it with AddonManager you must replace
by
in this mode your addon is usable directly with many instalation of FreeCAD ( os Windows)
(what I have done)
thanks
mario
good macro thank for sharing
for install it with AddonManager you must replace
Code: Select all
FreeCAD.getHomePath()
Code: Select all
FreeCAD.getUserAppDataDir()
(what I have done)
thanks
mario
Maybe you need a special feature, go into Macros_recipes and Code_snippets, Topological_data_scripting.
My macros on Gist.github here complete macros Wiki and forum.
My macros on Gist.github here complete macros Wiki and forum.
Re: Starting and controlling FreeCAD from external console
sort of related, but more as a joke: If you're really interested in controlling FreeCAD externally:
https://forum.freecadweb.org/viewtopic.php?f=24&t=29988& (FrontPanel Simulation WB)
https://forum.freecadweb.org/viewtopic.php?f=24&t=29988& (FrontPanel Simulation WB)
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