Page MenuHome

Import/Export scale 1000
Closed, ArchivedPublic

Description

System Information
Macos 10.15.7

Blender Version
Version 2.92.0 (2.92.0 2021-02-25)

Exact steps for others to reproduce the error
Based on the default startup or an attached .blend file (as simple as possible).

I have problem. It work in both way, if i import stl model in blener - i need scale in 0.001 to set right measure. If i export, i need set 1000 scale.
Please fix this problem. I use blender for 3d printing and work with real mm.
I find https://developer.blender.org/T71704 marked resolved, but problem exist.

Event Timeline

Alaska (Alaska) closed this task as Archived.Jul 9 2021, 11:35 PM

STL if i remember dosn't support the scale... in it self.. so u have to work in meteres. and just scale your model down not the... settings in blender... as STL format dosn't support this. (from memory i might be wrong)

As this comment points out, STLs don't support units like meter or millimetres. And this is backed up by the wikipedia article for STL files: https://en.wikipedia.org/wiki/STL_(file_format)

STL files contain no scale information, and the units are arbitrary.

Because of this lack of scale, Blender will export your 3D model and map one blender unit (1 meter) to one STL unit. How big an STL unit is depends on the program you're importing it into. If you import it into a slicer for a consumer 3D printer, an STL unit is usually determined as 1 millimetre. If you open it into most 3D modeling programs, an STL unit is probably 1 meter. If you import a STL into a game engine, it reads the STL unit is probably 1 meter.

The issue isn't with Blender, it's to do with the fact that STL files don't have units built in and the program opening it determines how large things should be. Blender has been chosen to read STL units as 1 meter because it's probably what most other programs use and it's very likely that at the time the STL importer and export was introduced, 3D printers were a very niche product.

As for why changing your units size in Blender to millimetres doesn't help is because if it did change the size of the final STL, you could face loads of issues when collaborating on projects as all these different objects, all from the same program, have completely different scales.

In theory a "fix" could be introduced by adding a "Export for 3D printing" and "Import 3D printing file" option to the export and import screens, but there's no guarantee that this will be the right scale for all 3D printers, especially with large 3D printers (E.G. Ones that print in concrete). So at the moment, you just need to keep importing and exporting your STL files with the 1000x and 0.001x scale modifiers or make your objects 1000x bigger than they should be so you don't have to scale them on import and export for the 3D printer. (I personally do that for my 3D printer. I model everything in Blender but I treat 1 Blender meter as 1 real world millimetre and that means I don't have to scale anything)

ivan (Ivan_Zuko) added a comment.EditedJul 11 2021, 11:10 AM

Thanks!

It would be great if could save export and import settings. Every day i set parameters again. If you forget to check the "selected only" checkbox, then you have to wait until the whole model is exported and re-save.
Save in startup file - dos not work.

Alaska (Alaska) added a comment.EditedJul 12 2021, 1:49 AM

Thanks!

It would be great if could save export and import settings. Every day i set parameters again. If you forget to check the "selected only" checkbox, then you have to wait until the whole model is exported and re-save.
Save in startup file - dos not work.

At the moment changing the default is not supported, and requesting for the feature to be added is technically a feature request and this site isn't for tracking feature requests. Please use other channels for user feedback and feature requests: https://wiki.blender.org/wiki/Communication/Contact#User_Feedback_and_Requests

However, there is a way to do it if you wish to do a little bit of extra work.
In the installation folder of Blender there is a python file that's used for the STL export. You can modify this file and change the defaults. You may not be able to access this file in future versions of Blender, but in the meantime you can so you can modify these settings.

The file is located at INSTALL LOCATION OF BLENDER/2.92/scripts/addons/io_mesh_stl/__init__.py

What you'll want to do is create a backup of the file, then open the file in a text editor and change the values to the defaults you want.

You're probably want to start off by scrolling down until you find a line like class ImportSTL(Operator, ImportHelper):. After this bit you'll find all the settings for the STL importer and their defaults.
Just a few lines below the line we found earlier you'll see:

global_scale: FloatProperty(
        name="Scale",
        soft_min=0.001, soft_max=1000.0,
        min=1e-6, max=1e6,
        default=1.0,
    )

Because this is your import settings, change the default value to 0.001

Next up you'll look for the line with class ExportSTL(Operator, ExportHelper): and once again for look for the global_scale part just a few lines below and change the default to 1000.0.

Above the global_scale part you'll also find:

use_selection: BoolProperty(
        name="Selection Only",
        description="Export selected objects only",
        default=False,
    )

Change the default to True and save the file. Now the defaults should be changed in Blender. Only the selected object will be exported and it will be scaled up 1000 times so it's the right scale in slicers. When importing objects they will be scaled to 0.001 which means that if they're files designed for slicers, they should be the right size in Blender.


You will need to do this for every version of Blender you use which can be annoying, however what you can do is grab the STL exporter and importer from one version of Blender, modify it to have the settings you want, then turn it into a add-on that you just install in every version of Blender you use. I believe it's just as simple as putting everything inside the INSTALL LOCATION OF BLENDER/2.92/scripts/addons/io_mesh_stl/ folder into a .zip file then adding it to Blender as a normal add-on and disabling the default STL exporter and importer, but there might be extra work that needs to be done, not entirely sure.

Thank you! That's what I need! ^_^