Preliminary 3d prontery.
This commit is contained in:
parent
f981ef7a5f
commit
0a6cc0babb
5 changed files with 111802 additions and 0 deletions
8
bin/badge.scad
Normal file
8
bin/badge.scad
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
resize([50,50,5])
|
||||
mirror()
|
||||
intersection() {
|
||||
scale([1,1,10])
|
||||
surface(file = "badge.dat", convexity = 5);
|
||||
translate([0,0,-300]) scale([1,1,1000])
|
||||
surface(file = "badge-shape.dat", convexity = 5);
|
||||
}
|
||||
25
bin/export.sh
Executable file
25
bin/export.sh
Executable file
|
|
@ -0,0 +1,25 @@
|
|||
#!/bin/bash -x
|
||||
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Usage: ./export.sh \$BADGE \$SIZE"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
badge=$1
|
||||
size=$2
|
||||
|
||||
|
||||
# cleanup from our last run
|
||||
rm -f badge.png badge-shape.png badge.dat badge-shape.dat
|
||||
|
||||
# Kick it off
|
||||
inkscape --export-png=badge.png --export-width=$size --export-height=$size ../svgs/$badge.svg
|
||||
inkscape --export-png=badge-shape.png --export-width=$size --export-height=$size ../svgs/badge-shape.svg
|
||||
python png2heightmap.py badge.png > badge.dat
|
||||
python png2heightmap.py badge-shape.png > badge-shape.dat
|
||||
openscad badge.scad -o ../stls/$badge.stl
|
||||
admesh --write-binary-stl=../stls/badge.stl ../stls/badge.stl
|
||||
echo "Done with ../stls/$badge.stl"
|
||||
|
||||
# and.. cleanup.
|
||||
rm -f badge.png badge-shape.png badge.dat badge-shape.dat
|
||||
16
bin/png2heightmap.py
Executable file
16
bin/png2heightmap.py
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/bin/python
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import png
|
||||
|
||||
image = png.Reader(sys.argv[1])
|
||||
|
||||
width, height, pixels, metadata = image.asRGBA()
|
||||
|
||||
for row in pixels:
|
||||
for pixel in range(0, width*4, 4):
|
||||
gray = (row[pixel] + row[pixel+1] + row[pixel+2]) / 3
|
||||
norm = (gray-127.5)/255.0
|
||||
print(' ', end='')
|
||||
print(norm, end='')
|
||||
print()
|
||||
109608
stls/free-mediaI.stl
Normal file
109608
stls/free-mediaI.stl
Normal file
File diff suppressed because it is too large
Load diff
2145
svgs/badge-shape.svg
Normal file
2145
svgs/badge-shape.svg
Normal file
File diff suppressed because it is too large
Load diff
|
After Width: | Height: | Size: 67 KiB |
Loading…
Add table
Add a link
Reference in a new issue