mirror of
https://github.com/BelfrySCAD/BOSL2.git
synced 2024-12-29 16:29:40 +00:00
tweaks to robertson recess
remove old icosa code for spheroid
This commit is contained in:
parent
5c7caa0a5c
commit
65ff040659
2 changed files with 7 additions and 49 deletions
|
@ -330,10 +330,14 @@ module torx_mask(size, l=5, center, anchor, spin=0, orient=UP) {
|
||||||
// robertson_mask(size, [extra]);
|
// robertson_mask(size, [extra]);
|
||||||
// Description:
|
// Description:
|
||||||
// Creates a mask for creating a Robertson/Square drive recess given the drive size as an integer.
|
// Creates a mask for creating a Robertson/Square drive recess given the drive size as an integer.
|
||||||
// The width of the recess will be oversized by `2 * $slop`.
|
// The width of the recess will be oversized by `2 * $slop`. Note that this model is based
|
||||||
|
// on an incomplete spec. https://www.aspenfasteners.com/content/pdf/square_drive_specification.pdf
|
||||||
|
// We determined the angle by doing print tests on a Prusa MK3S with $slop set to 0.05.
|
||||||
// Arguments:
|
// Arguments:
|
||||||
// size = The size of the square drive, as an integer from 0 to 4.
|
// size = The size of the square drive, as an integer from 0 to 4.
|
||||||
// extra = Extra length of drive mask to create.
|
// extra = Extra length of drive mask to create.
|
||||||
|
// ang = taper angle of each face. Default: 2.5
|
||||||
|
// $slop = enlarge recess by this twice amount. Default: 0
|
||||||
// Example:
|
// Example:
|
||||||
// robertson_mask(size=2);
|
// robertson_mask(size=2);
|
||||||
// Example:
|
// Example:
|
||||||
|
@ -341,7 +345,7 @@ module torx_mask(size, l=5, center, anchor, spin=0, orient=UP) {
|
||||||
// cyl(d1=2, d2=8, h=4, anchor=TOP);
|
// cyl(d1=2, d2=8, h=4, anchor=TOP);
|
||||||
// robertson_mask(size=2);
|
// robertson_mask(size=2);
|
||||||
// }
|
// }
|
||||||
module robertson_mask(size, extra=1) {
|
module robertson_mask(size, extra=1, ang=2.5) {
|
||||||
assert(is_int(size) && size>=0 && size<=4);
|
assert(is_int(size) && size>=0 && size<=4);
|
||||||
Mmin = [0.0696, 0.0900, 0.1110, 0.1315, 0.1895][size];
|
Mmin = [0.0696, 0.0900, 0.1110, 0.1315, 0.1895][size];
|
||||||
Mmax = [0.0710, 0.0910, 0.1126, 0.1330, 0.1910][size];
|
Mmax = [0.0710, 0.0910, 0.1126, 0.1330, 0.1910][size];
|
||||||
|
@ -352,7 +356,6 @@ module robertson_mask(size, extra=1) {
|
||||||
Fmin = [0.032, 0.057, 0.065, 0.085, 0.090][size];
|
Fmin = [0.032, 0.057, 0.065, 0.085, 0.090][size];
|
||||||
Fmax = [0.038, 0.065, 0.075, 0.095, 0.100][size];
|
Fmax = [0.038, 0.065, 0.075, 0.095, 0.100][size];
|
||||||
F = (Fmin + Fmax) / 2 * INCH;
|
F = (Fmin + Fmax) / 2 * INCH;
|
||||||
ang = 4;
|
|
||||||
h = T + extra;
|
h = T + extra;
|
||||||
Mslop=M+2*$slop;
|
Mslop=M+2*$slop;
|
||||||
down(T) {
|
down(T) {
|
||||||
|
|
|
@ -1696,7 +1696,7 @@ function spheroid(r, style="aligned", d, circum=false, anchor=CENTER, spin=0, or
|
||||||
rr = circum? (r / cos(90/vsides) / cos(180/hsides)) : r,
|
rr = circum? (r / cos(90/vsides) / cos(180/hsides)) : r,
|
||||||
stagger = style=="stagger"
|
stagger = style=="stagger"
|
||||||
)
|
)
|
||||||
style=="icosa2" ? // subdivide faces of an icosahedron and project them onto a sphere
|
style=="icosa" ? // subdivide faces of an icosahedron and project them onto a sphere
|
||||||
let(
|
let(
|
||||||
N = icosa_steps-1,
|
N = icosa_steps-1,
|
||||||
// construct an icosahedron
|
// construct an icosahedron
|
||||||
|
@ -1744,32 +1744,6 @@ function spheroid(r, style="aligned", d, circum=false, anchor=CENTER, spin=0, or
|
||||||
) [
|
) [
|
||||||
for (i=idx(meridians), j=[0:1:meridians[i]-1])
|
for (i=idx(meridians), j=[0:1:meridians[i]-1])
|
||||||
spherical_to_xyz(rr, j*360/meridians[i], i*180/(len(meridians)-1))
|
spherical_to_xyz(rr, j*360/meridians[i], i*180/(len(meridians)-1))
|
||||||
] : style=="icosa"? [
|
|
||||||
for (tb=[0,1], j=[0,2], i = [0:1:4]) let(
|
|
||||||
theta0 = i*360/5,
|
|
||||||
theta1 = (i-0.5)*360/5,
|
|
||||||
theta2 = (i+0.5)*360/5,
|
|
||||||
phi0 = 180/3 * j,
|
|
||||||
phi1 = 180/3,
|
|
||||||
v0 = spherical_to_xyz(1,theta0,phi0),
|
|
||||||
v1 = spherical_to_xyz(1,theta1,phi1),
|
|
||||||
v2 = spherical_to_xyz(1,theta2,phi1),
|
|
||||||
ax0 = vector_axis(v0, v1),
|
|
||||||
ang0 = vector_angle(v0, v1),
|
|
||||||
ax1 = vector_axis(v0, v2),
|
|
||||||
ang1 = vector_angle(v0, v2)
|
|
||||||
)
|
|
||||||
for (k = [0:1:icosa_steps]) let(
|
|
||||||
u = k/icosa_steps,
|
|
||||||
vv0 = rot(ang0*u, ax0, p=v0),
|
|
||||||
vv1 = rot(ang1*u, ax1, p=v0),
|
|
||||||
ax2 = vector_axis(vv0, vv1),
|
|
||||||
ang2 = vector_angle(vv0, vv1)
|
|
||||||
)
|
|
||||||
for (l = [0:1:k]) let(
|
|
||||||
v = k? l/k : 0,
|
|
||||||
pt = rot(ang2*v, v=ax2, p=vv0) * rr * (tb? -1 : 1)
|
|
||||||
) pt
|
|
||||||
] : assert(in_list(style,["orig","aligned","stagger","octa","icosa"])),
|
] : assert(in_list(style,["orig","aligned","stagger","octa","icosa"])),
|
||||||
lv = len(verts),
|
lv = len(verts),
|
||||||
faces = style=="orig"? [
|
faces = style=="orig"? [
|
||||||
|
@ -1830,25 +1804,6 @@ function spheroid(r, style="aligned", d, circum=false, anchor=CENTER, spin=0, or
|
||||||
[p5, p7, p8],
|
[p5, p7, p8],
|
||||||
if (k<m-1) [p5, p8, p6],
|
if (k<m-1) [p5, p8, p6],
|
||||||
],
|
],
|
||||||
] : style=="icosa"? let(
|
|
||||||
pyr = [for (x=[0:1:icosa_steps+1]) x],
|
|
||||||
tri = sum(pyr),
|
|
||||||
soff = cumsum(pyr)
|
|
||||||
) [
|
|
||||||
for (tb=[0,1], j=[0,1], i = [0:1:4]) let(
|
|
||||||
base = ((((tb*2) + j) * 5) + i) * tri
|
|
||||||
)
|
|
||||||
for (k = [0:1:icosa_steps-1])
|
|
||||||
for (l = [0:1:k]) let(
|
|
||||||
v1 = base + soff[k] + l,
|
|
||||||
v2 = base + soff[k+1] + l,
|
|
||||||
v3 = base + soff[k+1] + (l + 1),
|
|
||||||
faces = [
|
|
||||||
if(l>0) [v1-1,v1,v2],
|
|
||||||
[v1,v3,v2],
|
|
||||||
],
|
|
||||||
faces2 = (tb+j)%2? [for (f=faces) reverse(f)] : faces
|
|
||||||
) each faces2
|
|
||||||
] : []
|
] : []
|
||||||
) [reorient(anchor,spin,orient, r=r, p=verts), faces];
|
) [reorient(anchor,spin,orient, r=r, p=verts), faces];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue