File: height_map.scad

package info (click to toggle)
openscad-mcad 2019.05-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 448 kB
  • sloc: python: 113; makefile: 4
file content (31 lines) | stat: -rw-r--r-- 690 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/*
Height Map Example
Tony Buser <tbuser@gmail.com>
http://tonybuser.com
http://creativecommons.org/licenses/by/3.0/

Can also dynamically run this by passing an array on the command line:

/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -m make -D bitmap=[2,2,2,0,1,3,2,2,2] -D row_size=3 -s height_map.stl height_map.scad
*/

use <bitmap.scad>

block_size = 5;
height = 5;

row_size = 10; // 10x10 pixels
bitmap = [
	1,1,0,0,1,1,0,0,1,1,
	1,1,1,1,1,1,1,1,1,1,
	0,1,2,2,1,1,2,2,1,0,
	0,1,2,1,1,1,1,2,1,0,
	1,1,1,1,3,3,1,1,1,1,
	1,1,1,1,3,3,1,1,1,1,
	0,1,2,1,1,1,1,2,1,0,
	0,1,2,2,1,1,2,2,1,0,
	1,1,1,1,1,1,1,1,1,1,
	1,1,0,0,1,1,0,0,1,1
];

bitmap(bitmap, block_size, height, row_size);