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'.
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.
$ /path/to/FreeCAD -c
$ /path/to/FreeCADCmd
help()
.modules freecad
.