-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwindbreaker_draw.py
86 lines (64 loc) · 2.3 KB
/
windbreaker_draw.py
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
def windbreaker_top_down_view(canvas, canvas_type, datum, wb):
wb_color = 'orange'
if wb.joggle == 'No':
thickness = float(wb.thickness)
else:
thickness = float(wb.joggle_width)
width = float(wb.width)
if wb.side == 'LHS':
x = datum[0]
y = datum[1]
x_coords = [x, x, x-thickness, x-thickness, x]
y_coords = [y, y-width, y-width, y, y]
if canvas_type == 'matplotlib':
canvas.plot(x_coords,y_coords, color = wb_color)
elif canvas_type == 'dxf':
points = []
for index, v in enumerate(x_coords):
points.append((v, y_coords[index]))
canvas.add_lwpolyline(points)
if wb.side == 'RHS':
x = datum[0]
y = datum[1]
x_coords = [x, x, x-thickness, x-thickness, x]
y_coords = [y, y+width, y+width, y, y]
if canvas_type == 'matplotlib':
canvas.plot(x_coords,y_coords, color = wb_color)
elif canvas_type == 'dxf':
points = []
for index, v in enumerate(x_coords):
points.append((v, y_coords[index]))
canvas.add_lwpolyline(points)
def windbreaker_side_view(canvas, canvas_type, datum, wb):
wb_color = 'orange'
x = datum[0]
y = datum[1]
height = float(wb.height)
thickness = float(wb.thickness)
if wb.joggle == 'No':
x_coords = [x, x, x-thickness, x-thickness, x]
y_coords = [y, y+height, y+height, y, y]
if canvas_type == 'matplotlib':
canvas.plot(x_coords,y_coords, color = wb_color)
elif canvas_type == 'dxf':
points = []
for index, v in enumerate(x_coords):
points.append((v, y_coords[index]))
canvas.add_lwpolyline(points)
elif wb.joggle == 'Yes':
joggle_width = float(wb.joggle_width)
joggle_lower = float(wb.joggle_lower)
joggle_upper= float(wb.joggle_upper)
#start at bottom right corner, go anti clockwise
x_coords = [x, x, x + joggle_width, x + joggle_width,
x + joggle_width - thickness, x + joggle_width - thickness,
x - thickness, x-thickness, x]
y_coords = [y, joggle_lower, joggle_upper, height, height, joggle_upper,
joggle_lower, y, y]
if canvas_type == 'matplotlib':
canvas.plot(x_coords,y_coords, color = wb_color)
elif canvas_type == 'dxf':
points = []
for index, v in enumerate(x_coords):
points.append((v, y_coords[index]))
canvas.add_lwpolyline(points)