forked from SolidCode/SolidPython
-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy path10-customizer.py
More file actions
executable file
·29 lines (22 loc) · 889 Bytes
/
10-customizer.py
File metadata and controls
executable file
·29 lines (22 loc) · 889 Bytes
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
#! /usr/bin/env python
from solid2 import *
#register all the custom variables you want to use
objects = CustomizerDropdownVariable("objects", 4, [2, 4, 6])
side = CustomizerSliderVariable("side", 4)
cube_pos = CustomizerSliderVariable("cube_pos", [5, 5, 5])
cube_size = CustomizerSliderVariable("cube_size", 5)
customizedText = CustomizerDropdownVariable("text", "customize me!",
["customize me!", "Thank you!"])
#use scad_inline to use them
scene = scad_inline("""
for (i = [1:objects]){
translate([2*i*side,0,0]){
cube(side);
}
}
""")
scene += translate(cube_pos) (
cube(cube_size * 2))
scene += translate([0, -20, 0]) (
text(str(customizedText)))
scad_render_to_file(scene)