Headless FreeCAD: Difference between revisions
m (Added way to search freecad modules from console mode) |
(Marked this version for translation) |
||
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
<languages/> |
|||
⚫ | |||
{{TOCright}} |
|||
<translate> |
|||
⚫ | |||
<!--T:2--> |
|||
This wiki page will document various aspect of running FreeCAD in the console without enabling the GUI (Graphical User Interface) or what is called 'headless'. |
This wiki page will document various aspect of running FreeCAD in the console without enabling the GUI (Graphical User Interface) or what is called 'headless'. |
||
⚫ | |||
<!--T:4--> |
|||
⚫ | |||
⚫ | |||
<!--T:5--> |
|||
⚫ | |||
⚫ | |||
⚫ | |||
</translate> |
|||
{{Code|lang=python|code= |
{{Code|lang=python|code= |
||
import FreeCADGui as Gui |
import FreeCADGui as Gui |
||
Line 20: | Line 27: | ||
view = Gui.subgraphFromObject(obj) |
view = Gui.subgraphFromObject(obj) |
||
}} |
}} |
||
<translate> |
|||
⚫ | |||
<!--T:6--> |
|||
⚫ | |||
== Examples == |
== Examples == <!--T:7--> |
||
=== Searching FreeCAD Modules === |
=== Searching FreeCAD Modules === <!--T:8--> |
||
<!--T:9--> |
|||
# Open the terminal |
# Open the terminal and type: |
||
#:{{incode|$ /path/to/FreeCAD -c}} |
#:{{incode|$ /path/to/FreeCAD -c}} |
||
#::or |
#::or |
||
#:{{incode|$ /path/to/FreeCADCmd}} |
#:{{incode|$ /path/to/FreeCADCmd}} |
||
# A python shell will start with a prompt. Type {{incode|help()}} |
# A python shell will start with a prompt. Type {{incode|help()}}. |
||
# A help text is displayed. |
|||
#:{{Code|lang=text|code= |
|||
⚫ | |||
[FreeCAD Console mode <Use Ctrl-D (i.e. EOF) to exit.>] |
|||
>>> help() |
|||
Welcome to Python 3.x's help utility! |
|||
If this is your first time using Python, you should definitely check out |
|||
the tutorial on the Internet at https://docs.python.org/3.8/tutorial/. |
|||
Enter the name of any module, keyword, or topic to get help on writing |
|||
Python programs and using Python modules. To quit this help utility and |
|||
return to the interpreter, just type "quit". |
|||
To get a list of available modules, keywords, symbols, or topics, type |
|||
"modules", "keywords", "symbols", or "topics". Each module also comes |
|||
with a one-line summary of what it does; to list the modules whose name |
|||
or summary contain a given string such as "spam", type "modules spam". |
|||
help> |
|||
}} |
|||
⚫ | |||
#:{{Code|code= |
|||
help> modules freecad |
|||
}} |
|||
== Related == |
== Related == <!--T:10--> |
||
<!--T:11--> |
|||
* [[Embedding FreeCAD#Using FreeCAD without GUI]] |
|||
* [[Embedding_FreeCAD#Using_FreeCAD_without_GUI|Embedding FreeCAD]] |
|||
* [[Start up and Configuration#Running FreeCAD without GUI .28headless.29]] |
|||
* [[Start_up_and_Configuration#Running_FreeCAD_without_GUI_(headless)|Start up and Configuration]] |
|||
</translate> |
|||
[[Category:Developer Documentation{{#translation:}}]] |
[[Category:Developer Documentation{{#translation:}}]] |
||
[[Category:Poweruser Documentation{{#translation:}}]] |
[[Category:Poweruser Documentation{{#translation:}}]] |
Latest revision as of 09:37, 20 November 2021
Introduction
This wiki page will document various aspect of running FreeCAD in the console without enabling the GUI (Graphical User Interface) or what is called 'headless'.
Scenegraph Representation
As it's not possible to create or access the view provider in headless mode. What's possible is to load FreeCADGui
in headless mode but there is no way to access the GUI document because it won't be created and consequently there exist no view providers.
However, what's possible is to create a scenegraph representation of an object:
import FreeCADGui as Gui
from pivy import coin
Gui.setupWithoutGUI()
doc = App.newDocument()
obj = doc.addObject("Part::Box","Box")
doc.recompute()
view = Gui.subgraphFromObject(obj)
See: forum thread.
Examples
Searching FreeCAD Modules
- Open the terminal and type:
$ /path/to/FreeCAD -c
- or
$ /path/to/FreeCADCmd
- A python shell will start with a prompt. Type
help()
. - A help text is displayed.
- Type
modules freecad
.