-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathl-bracket
47 lines (37 loc) · 1.19 KB
/
l-bracket
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
def l = 80
def h = 110
def width = 20
def holes = 3
#Holes var = number of holes on top (horizontal) part.
#Holes on vertical part are distributed based on that.
def bracket(x as Number y as Number l as Number h as Number w as Number holes as Number) = {
def holeRadius = 2
def tLx = x - (l / 2)
def tLy = y + (h / 2)
def tRx = x + (l / 2)
def tRy = y + (h / 2)
def bLx = x - (l / 2)
def bLy = y - (h / 2)
def bRx = x + (l / 2)
def bRy = y - (h / 2)
line(tLx tLy tRx tRy) #TOP
line(tRx tRy bRx bRy) #RIGHT
line(bRx bRy bRx - width bRy) #BOTTOM
line(bRx - width tRy - width bRx - width bRy) #INNER VERTICAL
line(bRx - width tRy - width tLx tLy - width) #INNER HORIZONTAL
line(tLx tLy bLx tLy - width) #TOP
#TOP PART HOLES
def ctrX = x
def ctrY = tLy - width / 2
def spacingTop = (tRx - tLx) / holes
def holesBottom = h / spacingTop
def spacingBottom = (h - width) / holesBottom
repeat 0 to holes using i {
circle(tLx + (spacingTop * i) + spacingTop / 2 ctrY holeRadius)
}
#BOTTOM PART HOLES
repeat 0 to holesBottom using i {
circle(tRx - (width / 2) ctrY - (spacingBottom * i) + width holeRadius)
}
}
bracket(20 40 l h width holes)