Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Configure Blender STL Import/Export default settings

Configure Blender STL default settings

Blender STL default settings aren't what I like to have by default. Working in millimeters inside Blender makes the STLs come out tiny, so I tried to find a way to change these defaults and keep it that way.

Turns out they're baked into the io_mesh_stl script. This gist is a Windows PowerShell script to make the necessary adjustments. They are:
ImportSTL global_scale at becomes default=0.1

ExportSTL use_selection below at becomes default=True.

ExportSTL global_scale at becomes default=10.0


Run from gist:

PS:>iex ((new-object net.webclient).DownloadString(''))
# Find python init file regardless of Blender version in path
$file = (Resolve-Path "$env:ProgramFiles\Blender Foundation\Blender\*\scripts\addons\io_mesh_stl\")
if ($file) {
# Read the file
$x = [IO.File]::ReadAllText($file)
# For some reason in Blender 2.77 you have to correct ImportSTL to global_scale = 0.1
$import_global_scale = [regex] '(?s)(ImportSTL.+?global_scale = .+?default=)(.+?),'
# On export tick Use Selection
$export_use_selection = [regex] '(?s)(ExportSTL.+?use_selection = .+?default=)(.+?),'
# Change export scale unit because STL uses centimeters
$export_global_scale = [regex] '(?s)(ExportSTL.+?global_scale = .+?default=)(.+?),'
# Do the substitution and write it to file
$x -replace $import_global_scale, '${1}0.1, # MODIFIED' -replace $export_global_scale, '${1}10.0, # MODIFIED' -replace $export_use_selection, '${1}True, # MODIFIED' | Set-Content $file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.