New updated, simpler and more versatile version found here: https://marcofarias.com/how-to-convert-any-stp-step-igs-iges-brep-3d-model-file-to-a-stl-mesh-with-python/
Simple multithreaded Python script to convert STP/STEP to STL files based on Freecad.
This script should run on Windows, Linux and MacOS.
Requisites
- FreeCAD installed
- Python 3.x installed
How to run
Every file to convert must be in a directory called "3DModelsToConvert" in the root directory containing the STP-to-STL.py script.
The script will create two new directories within "3DModelsToConvert", one called "Converted-STLs" with the converted files and anotherone called "OriginalFiles".
Simply execute it by the following command from the root directory:
python3 STP-to-STL.py
Commments
This script becomes particularly useful when needed to convert a large batch of STP/STEP files to STL for further processing.
It is necessary to have FreeCAD installed in your OS. The main libraries used from the installation are the "Part" and "Mesh" libraries. I tried only abstracting those two libraries unsucessfully. It would be nice if someone finds a way to avoid having to install the whole program.
Hey, just discovered this and it looks awesome! I’d love to try it out but I’m getting a “DLL load failed while importing FreeCAD” error. It says the procedure cannot be found, although I’ve tried a few different paths for a FreeCAD install. Any reccomendations?
Hello Evan,
Could you provide more details?
In the program I coded different paths depending on which OS you are using, you can find the specific piece of code here: https://github.com/marcofariasmx/STP-STEP-to-STL-Python-Converter/blob/8dde52831d65a11427b53d325306c673c29a1f98/STP-to-STL.py#L12
Maybe try tweaking it. Also make sure to first find the FreeCAD.so or FreeCAD.dll file in your PC to make sure it is there and that it is in the correct path.
Good luck!
How to install the latest version of freecad on CentOS ?
Should be similar to all other versions of Linux