Headless FreeCAD

From FreeCAD Documentation
Revision as of 18:59, 24 February 2021 by Kunda1 (talk | contribs) (started documenting running FC inheadless mode)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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. This works this way:

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)
reference: forum thread

Related