I found some discrepancies between Import and ImportGui relative to file structure.
I am calling FreeCAD from a Python script to generate drawings in a server environment, without GUI, and I'd rather keep it so, without resorting to xvfb (because startup time and resources usage would increase exponentially).
Now, I want to export whatever drawing I am generating with a wrapping App::Part. I do this programmatically, with the following lines, where __objs__ is the list of Bodies I want to export:
Code: Select all
root = FreeCAD.ActiveDocument.addObject('App::Part', 'Root')
root.Label = 'RootLabel'
root.addObjects(__objs__)
Code: Select all
import Import
Import.export([root], "<path>.step"))
'RootLabel' is not a shape, export will be ignored.
Of course, the same exact command through ImportGui works perfectly:
Code: Select all
import ImportGui
ImportGui.export([root], "<path>.step"))
Thank you,
Daniel