80 lines
3.2 KiB
Markdown
80 lines
3.2 KiB
Markdown
|
|
# Goal
|
||
|
|
1) Create a single glb (binary glTF [Graphics Library Transmission Format])from an STL file. This is for testing or proof-of-concept.
|
||
|
|
2) Create a directory tree of conversions. This would be for production.
|
||
|
|
|
||
|
|
# Introduction
|
||
|
|
This procedure will use Blender to create glbs from the STLS in the source tree.
|
||
|
|
# Prerequisites
|
||
|
|
Source area for the Voron GitHub repositories containing STLs
|
||
|
|
ROOT directory to serve as a staging area for placing the glbs (and the HTML manifest and eventually pngs)
|
||
|
|
Blender (v. 5.0+)
|
||
|
|
|
||
|
|
# Procedure
|
||
|
|
## Step 1
|
||
|
|
Decide on a staging directory, example /home/jlpoole/work/Voron/test1, as this is where all the glb output and their directory paths will be placed.
|
||
|
|
|
||
|
|
Example:
|
||
|
|
|
||
|
|
mkdir /home/jlpoole/work/Voron/test1
|
||
|
|
|
||
|
|
## Step 3
|
||
|
|
cd to [THIS PROJECT]/ root directory.
|
||
|
|
|
||
|
|
Example, I cloned this project while under my Voron directory, so the directory "voronstl" was created by ```git clone https://salemdata.net/repo/jlpoole/voronstl/src/branch/init_dev``` :
|
||
|
|
|
||
|
|
cd /home/jlpoole/work/Voron/voronstl
|
||
|
|
|
||
|
|
### Step 3A - single glb
|
||
|
|
Execute:
|
||
|
|
blender-bin-5.0.0 --background --python create_glb.py -- \
|
||
|
|
[PATH TO A SINGLE STL FILE] \
|
||
|
|
[OUTPUT PATH & FILE]
|
||
|
|
Example:
|
||
|
|
|
||
|
|
jlpoole@jp ~/work/Voron/voronstl $ date; time blender-bin-5.0.0 --background --python create_glb.py -- /usr/local/src/Voron-Stealthburner/STLs/Stealthburner/'[o]_stealthburner_LED_carrier.stl' /tmp/out.glb
|
||
|
|
Thu Mar 5 09:21:59 PST 2026
|
||
|
|
Blender 5.0.0 (hash a37564c4df7a built 2025-11-18 10:44:21)
|
||
|
|
Timer 'STL Import' took 25.77 ms
|
||
|
|
INFO Draco mesh compression is available, use library at /opt/blender-bin-5.0.0/5.0/scripts/addons_core/io_scene_gltf2/libextern_draco.so
|
||
|
|
09:22:00 | INFO: Starting glTF 2.0 export
|
||
|
|
09:22:00 | INFO: Extracting primitive: [o]_stealthburner_LED_carrier
|
||
|
|
09:22:00 | INFO: Primitives created: 1
|
||
|
|
09:22:00 | INFO: Finished glTF 2.0 export in 0.008149147033691406 s
|
||
|
|
|
||
|
|
Wrote: /tmp/out.glb
|
||
|
|
|
||
|
|
Blender quit
|
||
|
|
|
||
|
|
real 0m0.938s
|
||
|
|
user 0m0.823s
|
||
|
|
sys 0m0.206s
|
||
|
|
jlpoole@jp ~/work/Voron/voronstl $ ls -la /tmp/out.glb
|
||
|
|
-rw-r--r-- 1 jlpoole jlpoole 154128 Mar 5 09:22 /tmp/out.glb
|
||
|
|
jlpoole@jp ~/work/Voron/voronstl $
|
||
|
|
|
||
|
|
|
||
|
|
### Step 3B - tree of glbs
|
||
|
|
|
||
|
|
Use Perl script: extract_first_path.pl v. 11
|
||
|
|
|
||
|
|
find /usr/local/src/Voron-Stealthburner/STLs -name '*.stl' -print0 |
|
||
|
|
while IFS= read -r -d '' f; do
|
||
|
|
blender-bin-5.0.0 --background --python create_glb.py -- "$f"
|
||
|
|
done
|
||
|
|
|
||
|
|
find /home/jlpoole/work/Voron/Klicky-Probe -name '*.stl' -print0 |
|
||
|
|
while IFS= read -r -d '' f; do
|
||
|
|
echo "$f"
|
||
|
|
#blender-bin-5.0.0 --background --python create_glb.py -- "$f"
|
||
|
|
done
|
||
|
|
|
||
|
|
Caution: make sure you have the directory only relevant to your build. For example Klicky-Probe has 186 STLs in its tree, but for the Voron Trident, we only are interested in 14 of the project's files.
|
||
|
|
|
||
|
|
jlpoole@jp ~/work/Voron/test2 $ find /home/jlpoole/work/Voron/Klicky-Probe -name '*.stl' -print0 | while IFS= read -r -d '' f; do echo "$f"
|
||
|
|
done |wc -l
|
||
|
|
186
|
||
|
|
jlpoole@jp ~/work/Voron/test2 $
|
||
|
|
But,
|
||
|
|
jlpoole@jp ~/work/Voron/renderlab $ cat /home/jlpoole/workstation/perl/Voron/manifest.txt | grep Klicky |wc -l
|
||
|
|
14
|
||
|
|
jlpoole@jp ~/work/Voron/renderlab $
|