added awesome modular multi-hdd-case
This commit is contained in:
137
openscad/foreign/modular multi-hdd case/Modules/Box/rounded.scad
Normal file
137
openscad/foreign/modular multi-hdd case/Modules/Box/rounded.scad
Normal file
@@ -0,0 +1,137 @@
|
||||
/**
|
||||
* Módulos para dibujar cajas con bordes redondeados.
|
||||
*
|
||||
* @author Joaquín Fernández
|
||||
* @url https://gitlab.com/joaquinfq/openscad/blob/master/Modules/Box/rounded.scad
|
||||
* @license CC-BY-NC-4.0
|
||||
*/
|
||||
//----------------------------------------------------------
|
||||
use <../../Functions/is.scad>
|
||||
//----------------------------------------------------------
|
||||
/**
|
||||
* Genera las coordenadas para dibujar un rectángulo con las esquinas redondeadas.
|
||||
* Cada esquina puede tener un radio diferente.
|
||||
*
|
||||
* @param {Float} width Ancho del rectángulo.
|
||||
* @param {Float} height Alto del rectángulo.
|
||||
* @param {Float[]} radius Radios a usar para redondear cada esquina.
|
||||
*/
|
||||
function boxRoundedRect(width, height, radius = [ 1, 1, 1, 1 ]) = let(
|
||||
_r = radius[0] == undef
|
||||
? [ radius, radius, radius, radius ]
|
||||
: radius
|
||||
)
|
||||
[
|
||||
[
|
||||
[ 0, height - _r[0] ],
|
||||
[ _r[0], height - _r[0] ],
|
||||
[ _r[0], height ],
|
||||
[ width - _r[1], height ],
|
||||
[ width - _r[1], height - _r[1] ],
|
||||
[ width , height - _r[1] ],
|
||||
[ width , _r[2] ],
|
||||
[ width - _r[2], _r[2] ],
|
||||
[ width - _r[2], 0 ],
|
||||
[ _r[3], 0 ],
|
||||
[ _r[3], _r[3] ],
|
||||
[ 0, _r[3] ]
|
||||
],
|
||||
[
|
||||
[ _r[0], height - _r[0] ],
|
||||
[ width - _r[1], height - _r[1] ],
|
||||
[ width - _r[2], _r[2] ],
|
||||
[ _r[3], _r[3] ]
|
||||
]
|
||||
];
|
||||
//----------------------------------------------------------
|
||||
/**
|
||||
* Dibuja un bloque con los bordes XY redondeados.
|
||||
*
|
||||
* @param {Float} width Ancho del bloque (eje X).
|
||||
* @param {Float} height Largo del bloque (eje Y).
|
||||
* @param {Float} length Alto del bloque (eje Z).
|
||||
* @param {Float|Float[]} radius Radios del borde de cada esquina.
|
||||
*/
|
||||
module boxRounded(width, height, length, radius = [ 1, 1, 1, 1 ])
|
||||
{
|
||||
if (radius)
|
||||
{
|
||||
translate([ - width / 2, - height / 2, - length / 2 ])
|
||||
{
|
||||
linear_extrude(length)
|
||||
{
|
||||
boxRounded2d(width, height, radius);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cube([ width, height, length ], center = true);
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------
|
||||
/**
|
||||
* Dibuja un bloque con los bordes XY redondeados.
|
||||
*
|
||||
* @param {Float} width Ancho del bloque (eje X).
|
||||
* @param {Float} height Largo del bloque (eje Y).
|
||||
* @param {Float|Float[]} radius Radios del borde de cada esquina.
|
||||
*/
|
||||
module boxRounded2d(width, height, radius = [ 1, 1, 1, 1 ])
|
||||
{
|
||||
// Si se pasa un número, lo convertimos a un array.
|
||||
_radius = isArray(radius)
|
||||
? radius
|
||||
: [ radius, radius, radius, radius ];
|
||||
_data = boxRoundedRect(width, height, _radius);
|
||||
polygon(points = _data[0]);
|
||||
for (_index = [ 0 : 3 ])
|
||||
{
|
||||
if (_radius[_index] > 0)
|
||||
{
|
||||
translate(_data[1][_index])
|
||||
{
|
||||
circle(r = _radius[_index]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//----------------------------------------------------------
|
||||
/**
|
||||
* Dibuja un bloque con todos los bordes redondeados.
|
||||
*
|
||||
* @param width Ancho del bloque (eje X).
|
||||
* @param height Largo del bloque (eje Y).
|
||||
* @param length Alto del bloque (eje Z).
|
||||
* @param radius Radio del borde.
|
||||
*/
|
||||
module boxRounded3d(width, height, length, radius = 1)
|
||||
{
|
||||
if (radius > 0)
|
||||
{
|
||||
hull()
|
||||
{
|
||||
for (z = [ -1, 1 ])
|
||||
{
|
||||
for (y = [ -1, 1 ])
|
||||
{
|
||||
for (x = [ -1, 1 ])
|
||||
{
|
||||
translate([
|
||||
x * (width / 2 - radius),
|
||||
y * (height / 2 - radius),
|
||||
z * (length / 2 - radius)
|
||||
])
|
||||
{
|
||||
sphere(r = radius, center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cube([ width, height, length ], center = true);
|
||||
}
|
||||
}
|
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* Genera una bandeja para insertar un modelo.
|
||||
*
|
||||
* @author Joaquín Fernández
|
||||
* @url https://gitlab.com/joaquinfq/openscad/blob/master/Modules/Box/tray.scad
|
||||
* @license CC-BY-NC-4.0
|
||||
*/
|
||||
//----------------------------------------------------------
|
||||
/**
|
||||
* Permite dibujar una bandeja y decidir cuáles caras eliminar.
|
||||
*
|
||||
* Los lados de la bandeja se enumeran de la siguiente manera (con respecto al plano XZ):
|
||||
*
|
||||
* - a : Parte trasera.
|
||||
* - b : Parte inferior.
|
||||
* - l : Parte izquierda.
|
||||
* - r : Parte derecha.
|
||||
* - t : Parte superior.
|
||||
*
|
||||
* @param {Float} width Anchura de la bandeja a generar (eje X).
|
||||
* @param {Float} height Altura de la bandeja a generar (eje Y).
|
||||
* @param {Float} length Longitud de la bandeja a generar (eje Z).
|
||||
* @param {Float} thickness Grosor de las paredes de la bandeja.
|
||||
* @param {Boolean} sides Lados de la bandeja a omitir.
|
||||
*/
|
||||
module boxTray(width, height, length, thickness = 5, sides = [])
|
||||
{
|
||||
_t = 2 * thickness;
|
||||
difference()
|
||||
{
|
||||
cube([ width + _t, height + _t, length + thickness ]);
|
||||
translate([ thickness, thickness, 0 ])
|
||||
{
|
||||
if ($children)
|
||||
{
|
||||
children();
|
||||
}
|
||||
else
|
||||
{
|
||||
cube([ width, height, length ]);
|
||||
}
|
||||
}
|
||||
for (_s = sides)
|
||||
{
|
||||
if (_s == "a")
|
||||
{
|
||||
translate([ 0, 0, length ])
|
||||
{
|
||||
cube([ width + _t, height + _t, _t ]);
|
||||
}
|
||||
}
|
||||
else if (_s == "b")
|
||||
{
|
||||
cube([ width + _t, thickness, length + _t ]);
|
||||
}
|
||||
else if (_s == "l")
|
||||
{
|
||||
translate([ width + thickness, 0, 0 ])
|
||||
{
|
||||
cube([ thickness, height + _t, length + _t ]);
|
||||
}
|
||||
}
|
||||
else if (_s == "r")
|
||||
{
|
||||
cube([ thickness, height + _t, length + _t ]);
|
||||
}
|
||||
else if (_s == "t")
|
||||
{
|
||||
translate([ 0, height + thickness, 0 ])
|
||||
{
|
||||
cube([ width + _t, thickness, length + _t ]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,152 @@
|
||||
/**
|
||||
* Modelos y variables según la especificación SFF-8200.
|
||||
*
|
||||
* @author Joaquín Fernández
|
||||
* @url https://gitlab.com/joaquinfq/openscad/blob/master/Modules/Models/SFF/8200.scad
|
||||
* @license CC-BY-NC-4.0
|
||||
*
|
||||
* @see SFF-8200 2.5" Form Factor Drives
|
||||
*/
|
||||
//----------------------------------------------------------
|
||||
use <../../Box/tray.scad>
|
||||
use <../box.scad>
|
||||
//----------------------------------------------------------
|
||||
/**
|
||||
* Devuelve las especificaciones de las medidas según SFF-8200.
|
||||
*
|
||||
* @param {Float} tolerance Tolerancia a usar para ajustar las medidas.
|
||||
* @param {Integer} type Tipo de unidad (0: pequeña, 1: mediana, 2: grande).
|
||||
*
|
||||
* @return {Float[]}
|
||||
*/
|
||||
function sff8200(tolerance = 0, type = 0) = [
|
||||
3.00, // Diámetro del tornillo
|
||||
(
|
||||
type == 0
|
||||
? 19.05
|
||||
: type == 1
|
||||
? 17.00
|
||||
: type == 2
|
||||
? 15.00
|
||||
: type == 3
|
||||
? 12.70
|
||||
: type == 4
|
||||
? 10.50
|
||||
: type == 5
|
||||
? 9.50
|
||||
: type == 6
|
||||
? 8.47
|
||||
: type == 7
|
||||
? 7.00
|
||||
: 5.00
|
||||
) + tolerance,
|
||||
0.00,
|
||||
0.50,
|
||||
69.85 + tolerance,
|
||||
0.25,
|
||||
100.45 + tolerance,
|
||||
undef,
|
||||
undef,
|
||||
undef,
|
||||
100.20 + tolerance, // #10
|
||||
100.50 + tolerance,
|
||||
110.20 + tolerance,
|
||||
undef,
|
||||
undef,
|
||||
undef,
|
||||
undef,
|
||||
undef,
|
||||
undef,
|
||||
undef,
|
||||
undef, // #20
|
||||
undef,
|
||||
undef,
|
||||
3.00 + tolerance / 2,
|
||||
34.93,
|
||||
38.10,
|
||||
undef,
|
||||
0.50,
|
||||
4.07 + tolerance / 2,
|
||||
61.72,
|
||||
34.93, // #30
|
||||
38.10,
|
||||
undef,
|
||||
0.50,
|
||||
undef,
|
||||
undef,
|
||||
undef,
|
||||
8.00,
|
||||
3.00,
|
||||
undef,
|
||||
undef, // #40
|
||||
2.50,
|
||||
undef,
|
||||
undef,
|
||||
undef,
|
||||
undef,
|
||||
undef,
|
||||
undef,
|
||||
undef,
|
||||
undef,
|
||||
14.00 + tolerance / 2, // #50
|
||||
90.60 + tolerance / 2,
|
||||
14.00 + tolerance / 2,
|
||||
90.60 + tolerance / 2
|
||||
];
|
||||
//----------------------------------------------------------
|
||||
/**
|
||||
* Dibuja un modelo de una unidad de 3.5" según la especificación SFF-8200.
|
||||
*
|
||||
* Este modelo permite extraer el volumen posteriormente para crear una ranura
|
||||
* como las usadas en las cajas de PCs.
|
||||
*
|
||||
* @param {Float} length Longitud de la unidad a generar.
|
||||
* @param {Float} thickness Grosor del bloque donde se insertará el modelo.
|
||||
* @param {Float} screw Diámetro del tornillo a usar.
|
||||
* @param {Float} slot Longitud de la ranura donde se insertarán los tornillos.
|
||||
* @param {Float} tolerance Valor a usar para ajustar las medidas estándar.
|
||||
* @param {Integer} type Tipo de unidad (0: pequeña, 1: mediana, 2: grande).
|
||||
*/
|
||||
module sff8200Model(length = 0, thickness = 5, screw = 0, slot = 15, tolerance = 0.3, type = 0)
|
||||
{
|
||||
_A = sff8200(tolerance, type);
|
||||
modelBox(
|
||||
_A[4],
|
||||
_A[1],
|
||||
length ? length : _A[6],
|
||||
thickness,
|
||||
screw ? screw : _A[0],
|
||||
slot,
|
||||
[
|
||||
[ _A[23], _A[6] - _A[52] ],
|
||||
[ _A[23], _A[6] - _A[53] ]
|
||||
],
|
||||
[
|
||||
[ _A[28], _A[6] - _A[50] ],
|
||||
[ _A[28], _A[6] - _A[51] ],
|
||||
[ _A[4] - _A[28], _A[6] - _A[50] ],
|
||||
[ _A[4] - _A[28], _A[6] - _A[51] ]
|
||||
]
|
||||
);
|
||||
}
|
||||
//----------------------------------------------------------
|
||||
/**
|
||||
* Dibuja una bandeja que puede insertarse en una ranura donde va una unidad de 3.5".
|
||||
*
|
||||
* @param {Float} length Longitud de la unidad a generar.
|
||||
* @param {Float} thickness Grosor del bloque donde se insertará el modelo.
|
||||
* @param {Float} screw Diámetro del tornillo a usar.
|
||||
* @param {Float} slot Longitud de la ranura donde se insertarán los tornillos.
|
||||
* @param {Float} tolerance Valor a usar para ajustar las medidas estándar.
|
||||
* @param {Boolean} sides Lados a eliminar de la bandeja.
|
||||
* @param {Integer} type Define la altura según el tipo de unidad (0: más grande, 8: más pequeña).
|
||||
*/
|
||||
module sff8200Tray(length = 0, thickness = 5, screw = 0, slot = 15, tolerance = 0.3, sides = [ "a", "t" ], type = 0)
|
||||
{
|
||||
_A = sff8200(tolerance, type);
|
||||
boxTray(_A[4], _A[1], length ? length : _A[6], thickness, sides)
|
||||
{
|
||||
sff8200Model(length, thickness, screw ? screw : _A[0], slot, tolerance, type);
|
||||
}
|
||||
}
|
||||
//sff8200Tray();
|
@@ -0,0 +1,95 @@
|
||||
/**
|
||||
* Modelos y variables según la especificación SFF-8300.
|
||||
*
|
||||
* @author Joaquín Fernández
|
||||
* @url https://gitlab.com/joaquinfq/openscad/blob/master/Modules/Models/SFF/8300.scad
|
||||
* @license CC-BY-NC-4.0
|
||||
*
|
||||
* @see SFF-8300 3.5" Form Factor Drives
|
||||
*/
|
||||
//----------------------------------------------------------
|
||||
use <../../Box/tray.scad>
|
||||
use <../box.scad>
|
||||
//----------------------------------------------------------
|
||||
/**
|
||||
* Devuelve las especificaciones de las medidas según SFF-8300.
|
||||
*
|
||||
* @param {Float} tolerance Tolerancia a usar para ajustar las medidas.
|
||||
* @param {Integer} type Tipo de unidad (0: pequeña, 1: mediana, 2: grande).
|
||||
*
|
||||
* @return {Float[]}
|
||||
*/
|
||||
function sff8300(tolerance = 0, type = 1) = [
|
||||
3.00, // Diámetro del tornillo
|
||||
type == 0 ? 42.00 : (type == 1 ? 26.10 : 17.80) + tolerance,
|
||||
147.00 + tolerance,
|
||||
101.60 + tolerance,
|
||||
95.25 + tolerance,
|
||||
3.18,
|
||||
44.45 + tolerance / 2,
|
||||
41.28 + tolerance / 2,
|
||||
28.50 + tolerance / 2,
|
||||
101.60 + tolerance / 2,
|
||||
6.35 + tolerance / 2,
|
||||
0.25,
|
||||
0.50,
|
||||
76.20 + tolerance / 2
|
||||
];
|
||||
//----------------------------------------------------------
|
||||
/**
|
||||
* Dibuja un modelo de una unidad de 3.5" según la especificación SFF-8300.
|
||||
*
|
||||
* Este modelo permite extraer el volumen posteriormente para crear una ranura
|
||||
* como las usadas en las cajas de PCs.
|
||||
*
|
||||
* @param {Float} length Longitud de la unidad a generar.
|
||||
* @param {Float} thickness Grosor del bloque donde se insertará el modelo.
|
||||
* @param {Float} screw Diámetro del tornillo a usar.
|
||||
* @param {Float} slot Longitud de la ranura donde se insertarán los tornillos.
|
||||
* @param {Float} tolerance Valor a usar para ajustar las medidas estándar.
|
||||
* @param {Integer} type Tipo de unidad (0: pequeña, 1: mediana, 2: grande).
|
||||
*/
|
||||
module sff8300Model(length = 0, thickness = 5, screw = 0, slot = 15, tolerance = 0.3, type = 0)
|
||||
{
|
||||
_A = sff8300(tolerance, type);
|
||||
modelBox(
|
||||
_A[3],
|
||||
_A[1],
|
||||
length ? length : _A[2],
|
||||
thickness,
|
||||
screw ? screw : _A[0],
|
||||
slot,
|
||||
[
|
||||
[ _A[10], _A[2] - _A[8] ],
|
||||
[ _A[10], _A[2] - _A[8] - _A[9] ]
|
||||
],
|
||||
[
|
||||
[ _A[5], _A[2] - _A[7] ],
|
||||
[ _A[5], _A[2] - _A[7] - _A[6] ],
|
||||
[ _A[5], _A[2] - _A[7] - _A[13] ],
|
||||
[ _A[3] - _A[5], _A[2] - _A[7] ],
|
||||
[ _A[3] - _A[5], _A[2] - _A[7] - _A[6] ],
|
||||
[ _A[3] - _A[5], _A[2] - _A[7] - _A[13] ]
|
||||
]
|
||||
);
|
||||
}
|
||||
//----------------------------------------------------------
|
||||
/**
|
||||
* Dibuja una bandeja que puede insertarse en una ranura donde va una unidad de 3.5".
|
||||
*
|
||||
* @param {Float} length Longitud de la unidad a generar.
|
||||
* @param {Float} thickness Grosor del bloque donde se insertará el modelo.
|
||||
* @param {Float} screw Diámetro del tornillo a usar.
|
||||
* @param {Float} slot Longitud de la ranura donde se insertarán los tornillos.
|
||||
* @param {Float} tolerance Valor a usar para ajustar las medidas estándar.
|
||||
* @param {Boolean} sides Lados a eliminar de la bandeja.
|
||||
* @param {Integer} type Define la altura según el tipo de unidad (0: grande, 1: mediana, 2: pequeña).
|
||||
*/
|
||||
module sff8300Tray(length = 0, thickness = 5, screw = 0, slot = 15, tolerance = 0.3, sides = [ "a", "t" ], type = 1)
|
||||
{
|
||||
_A = sff8300(tolerance, type);
|
||||
boxTray(_A[3], _A[1], length ? length : _A[2], thickness, sides)
|
||||
{
|
||||
sff8300Model(length, thickness, screw ? screw : _A[0], slot, tolerance, type);
|
||||
}
|
||||
}
|
@@ -0,0 +1,82 @@
|
||||
/**
|
||||
* Modelo que dibuja una caja que puede tener tornillos y ranuras y que
|
||||
* puede usarse como un negativo sobre otra caja y obtener la diferencia.
|
||||
*
|
||||
* @author Joaquín Fernández
|
||||
* @url https://gitlab.com/joaquinfq/openscad/blob/master/Modules/Models/box.scad
|
||||
* @license CC-BY-NC-4.0
|
||||
*
|
||||
* @param {Float} width Anchura del modelo a generar.
|
||||
* @param {Float} height Altura del modelo a generar.
|
||||
* @param {Float} length Longitud del modelo a generar.
|
||||
* @param {Float} thickness Grosor del bloque donde se insertará el modelo.
|
||||
* @param {Float} screw Diámetro del tornillo a usar.
|
||||
* @param {Float} slot Longitud de la ranura donde se insertarán los tornillos.
|
||||
* @param {Float} tolerance Valor a usar para ajustar las medidas estándar.
|
||||
* @param {Float[]} side Coordenadas de los agujeros laterales.
|
||||
* @param {Float[]} bottom Coordenadas de los agujeros inferiores.
|
||||
*/
|
||||
module modelBox(width, height, length, thickness, screw = 0, slot = 0, side = [], bottom = [])
|
||||
{
|
||||
cube([ width, height, length ]);
|
||||
// Agujeros laterales
|
||||
for (_side = side)
|
||||
{
|
||||
if (slot)
|
||||
{
|
||||
hull()
|
||||
{
|
||||
for (_n = [ - slot / 2, slot / 2 ])
|
||||
{
|
||||
translate([ width / 2, _side[0], _side[1] + _n ])
|
||||
{
|
||||
rotate([ 0, 90, 0 ])
|
||||
{
|
||||
cylinder(d = screw, h = width + thickness * 2, center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
translate([ width / 2, _side[0], _side[1] ])
|
||||
{
|
||||
rotate([ 0, 90, 0 ])
|
||||
{
|
||||
cylinder(d = screw, h = width + thickness * 2, center = true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Agujeros inferiores
|
||||
for (_bottom = bottom)
|
||||
{
|
||||
if (slot)
|
||||
{
|
||||
hull()
|
||||
{
|
||||
for (_n = [ - slot / 2, slot / 2 ])
|
||||
{
|
||||
translate([ width - _bottom[0], 0, _bottom[1] + _n ])
|
||||
{
|
||||
rotate([ 90, 0, 0 ])
|
||||
{
|
||||
cylinder(d = screw, h = thickness);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
translate([ width - _bottom[0], 0, _bottom[1] ])
|
||||
{
|
||||
rotate([ 90, 0, 0 ])
|
||||
{
|
||||
cylinder(d = screw, h = thickness);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user