Headless FreeCAD: Difference between revisions
No edit summary |
|||
Line 11: | Line 11: | ||
As it's not possible to create or access the [[Viewprovider|view provider]] in headless mode. What's possible is to load {{incode|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. |
As it's not possible to create or access the [[Viewprovider|view provider]] in headless mode. What's possible is to load {{incode|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|scenegraph]] representation of an object |
However, what's possible is to create a [[Scenegraph|scenegraph]] representation of an object: |
||
</translate> |
</translate> |
Revision as of 09:26, 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
$ /path/to/FreeCAD -c
- or
$ /path/to/FreeCADCmd
- A python shell will start with a prompt. Type
help()
[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>
- Type
modules freecad
help> modules freecad