FreeCAD /
Step2STL
convert all step files in a directory to stl:
import FreeCAD import Part import Mesh import glob import os def step2stl(name): shape = Part.Shape() shape.read(name + '.step') mesh = Mesh.Mesh(shape.tessellate(0.1)) mesh.write(name + '.stl') pattern = '*.step' for file_path in glob.glob(pattern): print(file_path) # Get the filename without the path filename = os.path.basename(file_path) # Strip the extension from the filename base_filename, _ = os.path.splitext(filename) # Pass the base filename to the function step2stl(base_filename)
/Applications/FreeCAD.app/Contents/Resources/bin/freecadcmd ../step2stl.py