Native STL importer

Have been working for a while on a native STL importer

Importing 37 files in batch (see thread below)
New STL Importer: 2.929 seconds
Old STL Importer: 11.869 seconds

https://developer.blender.org/D13745

19 Likes

A simple benchmark

Importing 37 files in batch
New STL Importer: 2.929 seconds
Old STL Importer: 11.869 seconds

Uploading STLs soon

import bpy
from time import perf_counter
import os
import io
from contextlib import redirect_stdout


filepaths = [f.path for f in os.scandir("C:\\dev\\blender-git\\test_stls\\STL")]
print(f"Importing {len(filepaths)} files in batch")
t0 = perf_counter()
for p in filepaths:
    bpy.ops.wm.stl_import(filepath=p)
t1 = perf_counter()
print(f"New STL Importer: {t1 - t0}")

t0 = perf_counter()
with redirect_stdout(io.StringIO()) as f:
    for p in filepaths:
        bpy.ops.import_mesh.stl(filepath=p)
t1 = perf_counter()
print(f"Old STL Importer: {t1 - t0}")
6 Likes

test STLs link, all copyright to respective authors

will this stl importer be in 3.1?

I think no, I hope it gets asap, it is partly my fault it was delayed, hopefully review will continue

7 Likes

It won’t go into Blender sadly, there’s already an stl importer in the works and it part of obj/ply importer design

No code was written for STL or PLY.
Expanding on the chat in pipeline-assets-io-module: it’s better to reuse OBJ importer’s code or to keep the structure similar at least so that later refactors to reduce duplication are easier. The design was approved earlier, so building on that is likely the way to go.

1 Like

ok I see, sorry I misunderstood

New revision being developed here
https://developer.blender.org/D14941

3 Likes