-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaircraftclock
125 lines (99 loc) · 4.29 KB
/
aircraftclock
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
import font
def dia = 47 #CLOCK diaIAMETER
def scale = dia / 100 #scale factor
def fiveSize = 7 * scale #FIVE MINUTE MARKS SIZE
def oneSize = 4.5 * scale #ONE MINUTE MARKS SIZE
def textSize = 7 * scale #SIZE OF THE diaIGITS
def innerText = 15 * scale #INWARDS OFFSET OF diaIGITS
def textOffsetX = -0.4 * scale #ADJUSTMENT OF TEXT X
def textOffsetY = 1.8 * scale #ADJUSTMENT OF TEXT Y
#SIZES FOR 2 1/4 INSTRUMENT CUTOUTS
def rad = 57.15 / 2
def angle = 60.325 / 2
def bb = 66.675 / 2
def height = 4.318 / 2
def center = 23.6
#SIZES FOR 3 1/8 INSTRUMENT CUTOUTS
#def rad = 79.375 / 2
#def angle = 82.75 / 2
#def bb = 88.9 / 2
#def height= 4.318 / 2
#def center = 31.4
#helping lines for hole cutouts
#circle(0 0 bb)
#line(-1 * angle a angle -1 * angle) # diaiagonal
### END PARAMETERS ###
### START SCRIPT ###
line(-1 * angle -1 * angle -1 * angle angle)
line(angle -1 * angle angle angle)
line(-1 * angle angle angle angle)
line(-1 * angle -1 * angle angle -1 * angle)
#HOLES
circle(-1 * center center height)
circle(center center height)
circle(-1 * center -1 * center height)
circle(center -1 * center height)
#OUTER AND CENTER CIRCLE
circle(0 0 rad)
circle(0 0 rad - 2) #BEZEL
circle(0 0 1)
#calculate which diaigit to write
def setchar(vx as Number vy as Number id as Number ) = {
if(id < -1) {if(id > -3) {one(vx vy textSize) five(vx + (0.1 * dia) vy + (0.16 * dia) 2)}}
if(id < 0) {if(id > -2) {two(vx vy textSize) one(vx + (0.14 * dia) vy + (0.1 * dia) 2) zero(vx + (0.17 * dia) vy + (0.1 * dia) 2)}}
if(id < 1) {if(id > -1) {three(vx vy textSize) one(vx + (0.16 * dia) vy + (0.01 * dia) 2) five(vx + (0.19 * dia) vy + (0.01 * dia) 2)}}
if(id < 2) {if(id > 0) {four(vx vy textSize) two(vx + (0.14 * dia) vy - (0.07 * dia) 2) zero(vx + (0.17 * dia) vy - (0.07 * dia) 2)}}
if(id < 3) {if(id > 1) {five(vx vy textSize) two(vx + (0.08 * dia) vy - (0.12 * dia) 2) five(vx + (0.11 * dia) vy - (0.12 * dia) 2)}}
if(id < 4) {if(id > 2) {six(vx vy textSize) three(vx - (0.01 * dia) vy - (0.14 * dia) 2) zero(vx + 1.5 vy - (0.14 * dia) 2)}}
if(id < 5) {if(id > 3) {seven(vx vy textSize) three(vx - (0.1 * dia) vy - (0.12 * dia) 2) five(vx - (0.07 * dia) vy - (0.12 * dia) 2)}}
if(id < 6) {if(id > 4) {eight(vx vy textSize) four(vx - (0.16 * dia) vy - (0.06 * dia) 2) zero(vx - (0.13 * dia) vy - (0.06 * dia) 2)}}
if(id < 7) {if(id > 5) {nine(vx vy textSize) four(vx - (0.18 * dia) vy + (0.02 * dia) 2) five(vx - (0.15 * dia) vy + (0.02 * dia) 2)}}
if(id < 8) {if(id > 6) {one(vx - (textSize / 2) vy textSize)
zero(vx + (textSize / 2) vy textSize) five(vx - (0.16 * dia) vy + (0.1 * dia) 2) zero(vx - (0.13 * dia) vy + (0.1 * dia) 2) }}
if(id < 9) {if(id > 7) {one(vx - (textSize / 2) vy textSize)
five(vx - (0.1 * dia) vy + (0.16 * dia) 2) five(vx - (0.07 * dia) vy + (0.16 * dia) 2)
one(vx + (textSize / 2) vy textSize)}}
if(id < 10) {if(id > 8) {one(vx - (textSize / 2) vy textSize)
six(vx - (0.015 * dia) vy + (0.18 * dia) 2) zero(vx + (0.02 * dia) vy + (0.18 * dia) 2)
two(vx + (textSize / 2) vy textSize)}}
}
def outer = (dia / 2) - 1
def innerFive = (dia / 2) - fiveSize
def innerOne = (dia / 2) - oneSize
#FIVE MINUTE MARKS
repeat -2 to 10 using inc {
def vx = -1 * cos(radians(inc * 30))
def vy = sin(radians(inc * 30))
line(vx * innerFive vy * innerFive vx * outer vy * outer)
#TEXT
def textX = (-1 - vx * (dia / 2) - innerText) - textOffsetX
def textY = (-1 - vy * (dia / 2) - innerText) - textOffsetY
setchar(textX textY inc)
}
#ONE MINUTE MARKS
repeat 0 to 60 using inc {
def vx = cos(radians(inc * 6))
def vy = sin(radians(inc * 6))
line(vx * innerOne vy * innerOne vx * outer vy * outer)
}
def scale = dia / 100
C(-8 * scale 12 * scale 5 * scale)
L(-4 * scale 12 * scale 5 * scale)
O(0 * scale 12 * scale 5 * scale)
C(4 * scale 12 * scale 5 * scale)
K(8 * scale 12 * scale 5 * scale)
def s2 = scale * 2.25
#hour hand
line(-3 * s2 0.5 * s2 10 * s2 1.6 * s2 )
line(-3 * s2 -0.5 * s2 10 * s2 -1.6 * s2 )
line(10 * s2 1.6 * s2 13 * s2 0)
line(10 * s2 -1.6 * s2 13 * s2 0)
#minute hand
line(0.5 * s2 0.5 * s2 -9 * s2 10.7 * s2)
line(-0.5 * s2 -0.5 * s2 -10.5 * s2 9.5 * s2)
line(-9 * s2 10.7 * s2 -14 * s2 14 * s2)
line(-10.5 * s2 9.5 * s2 -14 * s2 14 * s2)
#second hand
line(-2.5 * s2 -3 * s2 15 * s2 14 * s2 )
line(-3 * s2 -2.5 * s2 14.5 * s2 14.7* s2 )
line(-2.5 * s2 -3 * s2 -3 * s2 -2.5 * s2)