I am trying to import step files on the command line and do something to them (eg. save them as collada file).
The problem is, they always loose the color/material when run on the commandline.
I was trying different things and ended up with some minimal examples:
Code: Select all
import FreeCAD
import Import
import importDAE
doc = FreeCAD.newDocument()
FreeCAD.setActiveDocument(doc.Name)
Import.insert("file.stp", doc.Name)
importDAE.export(doc.Objects, "file.dae")
Code: Select all
import FreeCAD
import ImportGui
import importDAE
doc = FreeCAD.newDocument()
FreeCAD.setActiveDocument(doc.Name)
ImportGui.insert("file.stp", doc.Name)
importDAE.export(doc.Objects, "file.dae")
And the plain Import Version runs perfectly on the commandline, but strips all colors.
I also tried
Code: Select all
import FreeCAD
import Part
import importDAE
doc = FreeCAD.newDocument()
FreeCAD.setActiveDocument(doc.Name)
Part.insert("file.stp", doc.Name)
importDAE.export(doc.Objects, "file.dae")
Part.insert("file.stp", doc.Name)
Seems to happen with every file I tried - and so it does with the AS1-TU-203 file from https://www.cax-if.org/library/index.html
All these examples can be used from within FreeCAD or as python scripts run with FreeCAD (the one without Gui can be run with FreeCAD or FreeCADCmd, doesn't matter)
I am running 0.18_pre 14976 on MacOSX AND Ubuntu (mainly because it is the only one I can run collada exports on without errors), but I see the same behavior on 0.17 (besides me being unable to export to collada).
Is there any way to import step files without Gui, while preserving the colors?