CLI scripts for import and exporting models into and out of Freecad
All scripts are run headlessly with FreeCAD's console binary and take their arguments from the end of the command line (FreeCAD prepends its own args):
freecadcmd -c <script.py> <args...>
freecadcmd -c newFile.py <output.FCStd>
freecadcmd -c importSTL.py <output.FCStd> <input.stl> <object_name>
Creates (or extends) output.FCStd with a Mesh::Feature named
<object_name>_Mesh.
freecadcmd -c export.py <input.FCStd> <output.stl>
Meshes every top-level solid in the document (children of containers such as
the Sketch/Pad features inside a PartDesign::Body are skipped so the
same geometry is not exported twice), merges the meshes, removes duplicate
points/facets and non-manifold facets, then writes an STL. Use the FreeCAD
GUI's mesh export settings (linear/angular deflection) if you need finer
tessellation.
freecadcmd -c importSTEP.py <output.FCStd> <input.step> <object_name>
Imports exact geometry (no tessellation) using Import.insert, re-homes each
solid as a Part::Feature named <object_name> (or <object_name>_<i> when
the file holds several solids), and removes the importer's temporary
container objects.
freecadcmd -c exportSTEP.py <input.FCStd> <output.step>
Writes every top-level shape (children skipped, see export.py) to a STEP
file using Import.export, preserving exact BRep geometry and placements.
freecadcmd -c importSVGToPose.py <output.FCStd> <input.svg> "<x,y,z>" "<az,el,tilt>" <slice_name> <body_name>
Used by BowlerStudio to add sliced geometry to a FreeCAD model.