Utilities for converting DXF outlines into extruded STL files, then optionally packing those STLs into OrcaSlicer 3MF projects with previews.
The active DXF-to-STL path uses Python 3 plus these packages:
ezdxfmanifold3dtrimesh
Install them with:
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install ezdxf manifold3d trimeshPlatform-specific examples:
py -3 -m venv .venv
.venv\Scripts\activate
py -3 -m pip install --upgrade pip
py -3 -m pip install ezdxf manifold3d trimeshpython3 -m venv .venv
source .venv/bin/activate
python3 -m pip install --upgrade pip
python3 -m pip install ezdxf manifold3d trimeshfolders_to_3mf.py shells out to the OrcaSlicer CLI.
The script tries OrcaSlicer in this order:
orca-sliceronPATHOrcaSliceronPATH- common Windows install paths under
C:\Program Files\OrcaSlicer\ /Applications/OrcaSlicer.app/Contents/MacOS/OrcaSlicer- Linux Flatpak via
flatpak run --command=orca-slicer com.orcaslicer.OrcaSlicer
If OrcaSlicer is installed in a nonstandard location, you can override the command with either:
Windows PowerShell:
$env:ORCA_SLICER_COMMAND="C:\path\to\OrcaSlicer.exe"macOS / Linux:
export ORCA_SLICER_COMMAND="/path/to/OrcaSlicer"Or pass it directly on the command line:
python3 folders_to_3mf.py dxf/1 --orca-command "/path/to/OrcaSlicer"Typical installer location:
C:\Program Files\OrcaSlicer\OrcaSlicer.exe
Some installs may use:
C:\Program Files\OrcaSlicer\orca-slicer.exe
If OrcaSlicer is not on PATH, run the 3MF workflow with:
py -3 folders_to_3mf.py dxf\1 --orca-command "C:\Program Files\OrcaSlicer\OrcaSlicer.exe"Typical .app location:
/Applications/OrcaSlicer.app/Contents/MacOS/OrcaSlicerThe script auto-detects that location. You can verify the CLI is reachable with:
"/Applications/OrcaSlicer.app/Contents/MacOS/OrcaSlicer" --helpCommon approaches:
orca-sliceronPATH- AppImage started from the folder where you downloaded it
- Flatpak:
flatpak run --command=orca-slicer com.orcaslicer.OrcaSlicerIf you use Flatpak, install it with:
flatpak install flathub com.orcaslicer.OrcaSlicerIf you use an AppImage, a common pattern is:
chmod +x OrcaSlicer_*.AppImage
./OrcaSlicer_*.AppImage --helpIn that case, pass the AppImage path explicitly:
python3 folders_to_3mf.py dxf/1 --orca-command "/path/to/OrcaSlicer_2.x.x.AppImage"DXF to STL:
py -3 batch_convert_dxf_to_stl.py dxf\5DXF folder to 3MF:
py -3 folders_to_3mf.py dxf\1 --orca-command "C:\Program Files\OrcaSlicer\OrcaSlicer.exe"DXF to STL:
python3 batch_convert_dxf_to_stl.py dxf/5DXF folder to 3MF:
python3 folders_to_3mf.py dxf/1DXF to STL:
python3 batch_convert_dxf_to_stl.py dxf/5DXF folder to 3MF with Flatpak:
python3 folders_to_3mf.py dxf/1DXF folder to 3MF with AppImage:
python3 folders_to_3mf.py dxf/1 --orca-command "/path/to/OrcaSlicer_2.x.x.AppImage"These are only needed for the older or standalone helper scripts:
convert_dxf_splines_to_stl.py:shapelyrepair_stl_pymeshlab.py:pymeshlabconvert_dxf_to_stl.py: FreeCAD with Python modulesFreeCAD,Mesh,Part, andimportDXF
Install the optional Python packages with:
python3 -m pip install shapely pymeshlabThe FreeCAD-based converter is separate from the active workflow and usually requires a FreeCAD installation provided by your OS package manager or the official FreeCAD distribution, not pip.
If you only want the current supported conversion path, install:
python3 -m pip install ezdxf manifold3d trimeshIf you also want 3MF export, install the core Python packages above and install OrcaSlicer in a location the script can detect, or pass --orca-command.
The current batch DXF-to-STL path is:
batch_convert_dxf_to_stl.py- command-line batch entry point for a single folder of DXFs.convert_dxf_manifold_to_stl.py- actual DXF-to-STL converter used by the batch script and 3MF workflow.
The broader folder-to-3MF workflow is:
folders_to_3mf.py- converts DXFs, exports one 3MF per folder with OrcaSlicer, and writes a log.grid_arrange_3mf.py- optional no-rotation grid layout pass.render_3mf_plate_preview.py- optional top-down PNG preview renderer.
Older/alternate standalone converters are still present, but are not used by the current batch path:
convert_dxf_to_stl.py- FreeCAD-based converter.convert_dxf_splines_to_stl.py- alternate spline/Shapely converter.repair_stl_pymeshlab.py- standalone STL repair helper.
Convert all DXFs directly inside one folder into that folder's stl subfolder:
python3 batch_convert_dxf_to_stl.py dxf/5Convert a folder into a separate output folder, matching the earlier stl_batch style:
python3 batch_convert_dxf_to_stl.py dxf/1 stl_batch --suffix _3mm_fixedOverwrite existing STL files:
python3 batch_convert_dxf_to_stl.py dxf/1 stl_batch --suffix _3mm_fixed --overwriteUse a different extrusion thickness or cleanup offset:
python3 batch_convert_dxf_to_stl.py dxf/5 --thickness 3 --cleanup 0.0005Scale the generated STLs uniformly:
python3 batch_convert_dxf_to_stl.py dxf/5 --scale 1.02 --suffix _scaled --overwriteScale only one or two axes:
python3 batch_convert_dxf_to_stl.py dxf/5 --scale-x 1.02 --scale-y 0.98 --suffix _xy_scaled --overwriteScale Z separately from the DXF outline. This keeps the X/Y footprint unchanged and makes the extrusion thicker:
python3 batch_convert_dxf_to_stl.py dxf/5 --thickness 3 --scale-z 1.25 --suffix _taller --overwriteConvert inch-based DXF coordinates to millimeters by scaling all axes by 25.4:
python3 batch_convert_dxf_to_stl.py dxf/5 --scale 25.4 --suffix _mm --overwriteConvert one DXF directly with the underlying converter:
python3 convert_dxf_manifold_to_stl.py dxf/5/64.dxf stl/64_3mm_fixed.stl 3 0.0005Convert one DXF directly with scaling:
python3 convert_dxf_manifold_to_stl.py dxf/5/64.dxf stl/64_scaled.stl 3 0.0005 --scale 1.02Create one arranged OrcaSlicer 3MF for a single folder:
python3 folders_to_3mf.py dxf/1Process every descendant folder that directly contains DXFs, like the earlier dxf/110-145 run:
python3 folders_to_3mf.py dxf/110-145 --recursive --skip-previewProcess every descendant folder and bake a scale into the converted STLs before 3MF export:
python3 folders_to_3mf.py dxf/110-145 --recursive --scale 1.02 --overwrite --skip-previewUse existing STLs in <folder>/stl and only create the 3MF:
python3 folders_to_3mf.py dxf/1 --skip-convert --overwritePackage an STL-only folder directly, such as STLs generated under the root stl output tree:
python3 folders_to_3mf.py stl/1 --overwritePackage every STL-only folder under the root stl output tree:
python3 folders_to_3mf.py stl --recursive --overwriteUse the saved printer/process/filament presets:
python3 folders_to_3mf.py dxf/1 \
--skip-convert \
--overwrite \
--orca-settings process_preset/process.json \
--orca-settings printer_preset/p1p.json \
--orca-filament filament_preset/pla.json \
--log-file dxf/1/p1p-profile-final-check.logIf no Orca preset flags are passed, folders_to_3mf.py automatically loads the repo presets from printer_preset, process_preset, and filament_preset. These portable presets target the built-in Bambu P1P, 0.20mm Standard, and Bambu PLA Basic profiles, so they do not depend on files from $HOME.
Create a 3MF, rewrite it into a no-rotation grid layout, and render a preview:
python3 folders_to_3mf.py dxf/1 \
--skip-convert \
--overwrite \
--grid-arrange \
--grid-spacing 2 \
--log-file dxf/1/grid-arrange-check.logThe 3MF workflow calls OrcaSlicer through Flatpak:
flatpak run --command=orca-slicer com.orcaslicer.OrcaSlicerGrid-arrange an existing 3MF in place:
python3 grid_arrange_3mf.py dxf/1/1.3mf --spacing 2Render a PNG preview for an existing 3MF:
python3 render_3mf_plate_preview.py dxf/1/1.3mf dxf/1/1.png --size 1600batch_convert_dxf_to_stl.pyonly scans DXF files directly inside the input folder; it ignores subdirectories.- By default,
batch_convert_dxf_to_stl.pywrites STLs to<input_folder>/stl. - By default,
folders_to_3mf.pyadds_3mm_fixedbefore each STL extension. folders_to_3mf.pywrites logs asfolders_to_3mf-<timestamp>.logunless--log-fileis provided.- Existing STLs and 3MFs are skipped unless
--overwriteis passed. --scaleis a uniform multiplier applied to X, Y, and Z.--scale-x,--scale-y, and--scale-zare additional per-axis multipliers. For example,--scale 25.4 --scale-z 0.5makes final Z scale12.7.