safety, glbs now have no sanitizing of file names; png & webP conversions work

This commit is contained in:
John Poole 2026-03-05 13:53:27 -08:00
commit 8181c9b2d4
11 changed files with 267 additions and 878 deletions

View file

@ -10,6 +10,10 @@ In a command console:
cd ...web/batch_glb_png
date; time ./link_glbs.sh [PATH to the root directory of your GitHub staging area]
You can verify how many links were created using:
...web/batch_glb_png $ ls -la glbs/ |wc -l
Example:
jlpoole@jp ~/work/Voron/voronstl/web/batch_glb_png $ date; time ./link_glbs.sh /home/jlpoole/work/Voron/test1
@ -27,4 +31,23 @@ Example:
sys 0m0.263s
jlpoole@jp ~/work/Voron/voronstl/web/batch_glb_png $ ls -la glbs/ |wc -l
136
jlpoole@jp ~/work/Voron/voronstl/web/batch_glb_png $
jlpoole@jp ~/work/Voron/voronstl/web/batch_glb_png $
And, the script can be run over-and-over again and not step on previously created links.
Example, see "skipped=131" below:
jlpoole@jp ~/work/Voron/voronstl/web/batch_glb_png $ date; time ./link_glbs.sh /home/jlpoole/work/Voron/test1
Wed Mar 4 19:04:07 PST 2026
ROOT: /home/jlpoole/work/Voron/test1
OUTDIR: /home/jlpoole/work/Voron/voronstl/web/batch_glb_png/glbs
LOG: link_glbs_20260304_190407.log
DONE. linked=0
0 skipped=131 (details in link_glbs_20260304_190407.log)
real 0m0.584s
user 0m0.645s
sys 0m0.333s
jlpoole@jp ~/work/Voron/voronstl/web/batch_glb_png $

View file

@ -0,0 +1,80 @@
# 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 $

View file

@ -0,0 +1,12 @@
# Goal
Created a manifest of the STL files.
# Introduction
The delivery of my LDO Voron Trident consisted of 2 boxes which I picked up at the West3D store on 2/1/2026 and the parts which were ordered to be printed and shipped to me which I received 2/23/2026. Included with the parts shipment were 14 printed pages of an HTML table ("Parts List"). The provenance of the 14 page document is unknown to me. I later learned the HTML of this workflow at: https://home.wizards-enclave.net/ "Automated configurator generation for 3D printing" which does something similar.
Any rate, my starting point for what was needed for my build is the Parts List. I was given the HTML file and from there extracted the STL file names and paths to create a manifest ("Manifest"). This exercise takes you through the steps of distilling the Parts List into a Manifest using a Perl script.
# Prerequisites
The digital HTML file used to generate the Parts List.
Perl and these additional packages: HTML::TableExtract
# Procedure

View file

@ -19,6 +19,8 @@ for this exercise, create a soft link within glbs to just one file, we're only g
ln -s ../../'[o]_stealthburner_LED_carrier.stl.glb' .
Note: remember to unlink this test file after this exercise so you do not pollute a future attempt to mass produce PNGs
Example:
~/work/Voron/voronstl/web/batch_glb_png/glbs $ ln -s ../../'[o]_stealthburner_LED_carrier.stl.glb' .
@ -46,6 +48,11 @@ Example:
Result: a PNG 1227 × 994:
![]([o]_stealthburner_LED_carrier.stl.png)
Cleanup the link you created:
cd web/batch_glb_png/glbs
unlink '[o]_stealthburner_LED_carrier.stl.glb'
# Conclusion
Using the steps above, you created a single PNG from a glb.
@ -53,4 +60,6 @@ The next step is to fill the glbs directory with links to the glbs perviously ge
node batch_render.js [your PNG specification, if you want]
that will create a PNG for every glb.
that will create a PNG for every glb.
Note: the names of the links created by the ```create_glb_links.sh``` has the files path built in to assure uniqueness and provide a provenance. Since these links are used only by the glb->PNG process, I've gone the extra step of including the original project and directory path in the file name to help identify the file. The PNGs will just use the file's name and not the additional prepended path characters.