230 lines
8.4 KiB
OpenSCAD
230 lines
8.4 KiB
OpenSCAD
wood_size = 12;
|
|
extra_offset = 20;
|
|
thickness_offset = 1;
|
|
|
|
measurements_window_test = [
|
|
[1.5, 2.5, 3.8, 5.3, 6.4, 7, 7.25, 7, 6.26, 5.7, 5.5, 4.3, 2.8, 2, 1.3, 0.2],
|
|
[1.5, 2.5, 3.8, 5.3, 6.4, 7, 7.25, 7, 6.26, 5.7, 5.5, 4.3, 2.8, 2, 1.3, 0.2],
|
|
[1.5, 2.5, 3.8, 5.3, 6.4, 7, 7.25, 7, 6.26, 5.7, 5.5, 4.3, 2.8, 2, 1.3, 0.2],
|
|
[1.5, 2.5, 3.8, 5.3, 6.4, 7, 7.25, 7, 6.26, 5.7, 5.5, 4.3, 2.8, 2, 1.3, 0.2]
|
|
];
|
|
|
|
// WINDOW 1
|
|
//-------------------------------------------------------------------------------
|
|
|
|
width_window_1 = 595;
|
|
height_window_1 = 595;
|
|
|
|
// Order of measurements:
|
|
// tl, tr, br, bl
|
|
depths_window_1 = [70, 71, 62, 61];
|
|
|
|
// Order of measurements:
|
|
// top, right, bottom, left
|
|
|
|
measurements_window_1 = [
|
|
[-0.5, -0.9, -1.9, -2.9, -4.4, -5, -6.4, -7.5, -8.2, -8.1, -7.4, -6.8, -6.2, -4.8, -4.5, -2.7, -1.6, -0.7, -0.2],
|
|
[0.7, 2, 2.6, 3.6, 4.5, 5, 5.5, 6, 6, 5.6, 5.4, 5, 4.6, 4.3, 3.2, 2.2, 1.6, 0.4, 0],
|
|
[1.4, 2.9, 4.1, 5.5, 6.5, 7.7, 7.7, 7.7, 7.6, 7.4, 7.3, 6.9, 6.3, 5.4, 5, 4, 3.2, 2.4, 1.2],
|
|
[0.5, 0.6, 0.9, 2, 2.9, 3.7, 4.4, 4.5, 4.5, 4.6, 4.1, 3.8, 3.2, 2.2, 2.1, 1.6, 0.9, 0.5, 0]
|
|
];
|
|
|
|
step_window_1 = 30;
|
|
|
|
//-------------------------------------------------------------------------------
|
|
|
|
// WINDOW 2
|
|
//-------------------------------------------------------------------------------
|
|
|
|
width_window_2 = 595;
|
|
height_window_2 = 595;
|
|
|
|
// Order of measurements:
|
|
// tl, tr, br, bl
|
|
depths_window_2 = [62, 72, 68, 61];
|
|
|
|
// Order of measurements:
|
|
// top, right, bottom, left
|
|
|
|
measurements_window_2 = [
|
|
[1.5, 2.3, 2.6, 2.2, 2, 1.6, 1.1, 1.1, 1.1, 1.1, 1.1, 0.9, 0.5, 0.1, 0, -0.5, -0.8, -0.8, -0.4],
|
|
[0.8, 0.6, 2.7, 4, 4.6, 5.2, 5.3, 6, 6.2, 6.3, 5.9, 5.3, 4.8, 3.7, 2.2, 1.1, 0.4, 0.1, 0],
|
|
[1.3, 1.9, 2.7, 3.1, 4, 4.5, 4.5, 4.9, 4.3, 4.3, 4.2, 3.5, 3.5, 2.9, 2.2, 1.7, 1.3, 0.7, 0.1],
|
|
[0.3, 0.1, 0, 0, 0, 0, 0, -0.4, -0.7, -0.8, -1.5, -1.6, -2.2, -2.1, -1.5, -0.9, -0.4, -0.1, 0]
|
|
];
|
|
|
|
step_window_2 = 30;
|
|
|
|
//-------------------------------------------------------------------------------
|
|
|
|
// WINDOW 3
|
|
//-------------------------------------------------------------------------------
|
|
|
|
width_window_3 = 890;
|
|
height_window_3 = 539;
|
|
|
|
// Order of measurements:
|
|
// tl, tr, br, bl
|
|
depths_window_3 = [63, 72, 70, 65];
|
|
|
|
// Order of measurements:
|
|
// top, right, bottom, left
|
|
|
|
measurements_window_3 = [
|
|
[-0.4, -0.9, -1.4, -1.5, -1, -0.8, -0.4, -0.2, -1, -1.2, -1.5, -1.4, -1, -0.8, -0.4, -0.4, -0.9, -1.4, -2, -2.3, -2.4, -1.7, -1.7, -0.8, -0.1, 0, 0, 0, -0.4],
|
|
[2.5, 4.7, 5.8, 6.3, 6.9, 6.7, 6.7, 6.6, 6.3, 5.8, 4.8, 4.2, 3.8, 2.6, 1.7, 0.7, 0.1],
|
|
[0, 0, 0, 0, 0, -0.7, -1, -1, -1, -0.4, -0.1, 0, 0.1, 0.4, 1, 1, 0.6, 0.7, 0.7, 0.9, 0.9, 1, 1, 1.1, 1.2, 1.4, 1.2, 0.6, 0.1],
|
|
[1.1, 2.4, 3, 3.5, 3, 2.8, 2.4, 2.3, 2.3, 2.3, 2.1, 1.6, 1.3, 1.3, 0.5, 0.2, 0.2]
|
|
];
|
|
|
|
step_window_3 = 30;
|
|
|
|
//-------------------------------------------------------------------------------
|
|
|
|
// WINDOW 4
|
|
//-------------------------------------------------------------------------------
|
|
|
|
width_window_4 = 899;
|
|
height_window_4 = 555;
|
|
|
|
// Order of measurements:
|
|
// tl, tr, br, bl
|
|
depths_window_4 = [67, 74, 64, 64];
|
|
|
|
// Order of measurements:
|
|
// top, right, bottom, left
|
|
|
|
measurements_window_4 = [
|
|
[0.5, 2.4, 3.9, 4.2, 5.2, 4.7, 4.8, 4.4, 5.4, 6.2, 6, 6.5, 6.9, 6.9, 7.3, 7.2, 6.8, 7.4, 7.2, 7.2, 6, 4.2, 2.9, 1.5, 0.7, 0, 0, 0, 0],
|
|
[0.1, 0, 0, 0, 0, 0.5, 1.1, 1.6, 2.6, 3.2, 3.7, 3.2, 2.7, 1.6, 1.4, 1.1, 0.4, 0],
|
|
[-0.5, -0.6, -1.3, -1.3, -1.2, -0.8, -0.1, -0.4, -0.3, -0.1, -0.4, -0.6, -0.6, -0.6, -0.8, -1.4, -1.4, -1.4, -1.6, -1.7, -1.8, -1.4, -1.5, -1.3, -0.9, -1.1, -0.8, -0.4, -0.1],
|
|
[0.3, 1.3, 2.3, 3, 4, 4, 3.4, 2.6, 2.2, 1.5, 0.9, 0.6, 0.5, 0.5, 0.5, 0.5, 0.2, 0]
|
|
];
|
|
|
|
step_window_4 = 30;
|
|
|
|
//-------------------------------------------------------------------------------
|
|
|
|
// WINDOW 5
|
|
//-------------------------------------------------------------------------------
|
|
|
|
width_window_5 = 1002;
|
|
height_window_5 = 806;
|
|
|
|
// Order of measurements:
|
|
// tl, tr, br, bl
|
|
depths_window_5 = [68, 73, 72, 66];
|
|
|
|
// Order of measurements:
|
|
// top, right, bottom, left
|
|
|
|
measurements_window_5 = [
|
|
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
[1.2, 2.6, 3.7, 4.7, 5.9, 7.1, 7.5, 8.2, 8.2, 8.2, 7.9, 7.8, 7.3, 7, 6.5, 6.3, 6.3, 5.9, 5.4, 5.9, 5.6, 5, 4.3, 3.8, 2.1, 0.9],
|
|
[0, 0.1, 0.3, 0.6, 1.5, 2, 2, 2, 2, 2.5, 2.8, 2.8, 3, 3, 3, 3, 3.6, 3.6, 3.6, 3.8, 4, 4, 4, 4, 5.1, 5.1, 5.4, 5.1, 4.6, 3.7, 1.6, 0.3, 0.5],
|
|
[1.5, 2.1, 3, 3.9, 4.9, 5.5, 6.1, 6.2, 6.5, 6.1, 5.5, 5.3, 4.9, 4.5, 4.5, 4.8, 4.8, 4.8, 5.2, 6, 5.5, 5.5, 4.4, 3.2, 2.4, 1.2]
|
|
];
|
|
|
|
step_window_5 = 30;
|
|
|
|
//-------------------------------------------------------------------------------
|
|
|
|
// WINDOW 6
|
|
//-------------------------------------------------------------------------------
|
|
|
|
width_window_6 = 599;
|
|
height_window_6 = 1006;
|
|
|
|
// Order of measurements:
|
|
// tl, tr, br, bl
|
|
depths_window_6 = [71, 71, 71, 70];
|
|
|
|
// Order of measurements:
|
|
// top, right, bottom, left
|
|
|
|
measurements_window_6 = [
|
|
[1.2, 1.2, 0.7, 0.2, 0.2, 0.5, 0.2, 0.2, 0.1, 0.1, 0, 0, 0.1, 0, 0, 0.1, 0.8, 1.5, 2],
|
|
[0, 0.5, 0.8, 1.1, 1.5, 1.7, 2.6, 3.5, 3.9, 3.9, 4.5, 4.7, 5.3, 5.8, 5.9, 5.9, 5.9, 5.9, 6.4, 6.9, 6.7, 6.7, 6.7, 6.2, 5.6, 5.7, 5.4, 4.2, 3.2, 2.5, 1.5, 1.2, 0.3],
|
|
[1.5, 3.5, 5.2, 5, 5, 4.4, 4, 4, 4.7, 4.8, 3.9, 3.2, 2.3, 1.9, 2.3, 3.1, 4.4, 4, 1.6],
|
|
[0, 0, 0, 0.1, 0.7, 2, 2.8, 4.1, 4.9, 6.5, 7.1, 8.3, 9.4, 9.4, 9.8, 9.8, 9.1, 8.6, 8.6, 8.6, 8.8, 8.2, 7.6, 7.5, 6.9, 6.3, 4.9, 4.7, 4.2, 3.8, 3, 1.9, 0.8]
|
|
];
|
|
|
|
step_window_6 = 30;
|
|
|
|
//-------------------------------------------------------------------------------
|
|
|
|
module window_support(length, thickness_left, thickness_right, step, points){
|
|
max_iter = floor(length/step)-1;
|
|
poly = [
|
|
[-extra_offset,-thickness_left-thickness_offset],
|
|
[-extra_offset,0],
|
|
for(i = [0:max_iter]) [(i+1)*step, points[i]],
|
|
[length+extra_offset, points[max_iter]],
|
|
[length+extra_offset, -thickness_right-thickness_offset]
|
|
];
|
|
|
|
// Calculate z rotation for bottom edge along x axis
|
|
x = asin((thickness_right-thickness_left)/length);
|
|
|
|
linear_extrude(wood_size)
|
|
rotate(x, [0,0,1])
|
|
translate([0,thickness_left+thickness_offset,0])
|
|
polygon(poly);
|
|
}
|
|
|
|
// depths: top-left, top-right, bottom-right, bottom-left
|
|
// Use show_param to decide on which beam to visualize:
|
|
// 0: all, 1: top, 2: right, 3: bottom, 4: left
|
|
module window_frame(width, height, depths, measurements, step, show_param){
|
|
max_depth = max(depths);
|
|
depth_tl = max_depth - depths[0];
|
|
depth_tr = max_depth - depths[1];
|
|
depth_br = max_depth - depths[2];
|
|
depth_bl = max_depth - depths[3];
|
|
|
|
// top
|
|
if (show_param==1){
|
|
rotate(90, [0,0,1])
|
|
window_support(width, depth_tl, depth_tr, step, measurements[0]);
|
|
} else if(show_param==0){
|
|
translate([0,0,height])
|
|
window_support(width, depth_tl, depth_tr, step, measurements[0]);
|
|
}
|
|
|
|
|
|
// right
|
|
if (show_param==2){
|
|
rotate(90, [0,0,1])
|
|
window_support(height, depth_tr, depth_br, step, measurements[1]);
|
|
} else if(show_param==0){
|
|
translate([width,0,height])
|
|
rotate(90, [0,1,0])
|
|
window_support(height, depth_tr, depth_br, step, measurements[1]);
|
|
}
|
|
|
|
// bottom
|
|
if (show_param==3){
|
|
rotate(90, [0,0,1])
|
|
window_support(width, depth_bl, depth_br, step, measurements[2]);
|
|
} else if(show_param==0){
|
|
translate([0,0,-wood_size])
|
|
window_support(width, depth_bl, depth_br, step, measurements[2]);
|
|
}
|
|
|
|
// left
|
|
if (show_param==4){
|
|
rotate(90, [0,0,1])
|
|
window_support(height, depth_tl, depth_bl, step, measurements[3]);
|
|
} else if(show_param==0){
|
|
translate([-wood_size,0,height])
|
|
rotate(90, [0,1,0])
|
|
window_support(height, depth_tl, depth_bl, step, measurements[3]);
|
|
}
|
|
}
|
|
|
|
// window_frame(width_window_1, height_window_1, depths_window_1, measurements_window_1, step_window_1, 0);
|
|
// window_frame(width_window_2, height_window_2, depths_window_2, measurements_window_2, step_window_2, 4);
|
|
// window_frame(width_window_3, height_window_3, depths_window_3, measurements_window_3, step_window_3, 4);
|
|
// window_frame(width_window_4, height_window_4, depths_window_4, measurements_window_4, step_window_4, 4);
|
|
// window_frame(width_window_5, height_window_5, depths_window_5, measurements_window_5, step_window_5, 4);
|
|
window_frame(width_window_6, height_window_6, depths_window_6, measurements_window_6, step_window_6, 0); |