various fixes

This commit is contained in:
Adrian Mariano 2024-01-08 23:05:41 -05:00
parent 67cf7e9cb8
commit 1b971dff82
3 changed files with 13 additions and 12 deletions

View file

@ -1495,7 +1495,8 @@ module screw_head(screw_info,details=false, counterbore=0,flat_height,teardrop=f
[20, .165]]; [20, .165]];
intersection() { intersection() {
cyl(h=head_height/4, d=head_size, anchor=BOT) cyl(h=head_height/4, d=head_size, anchor=BOT)
attach(TOP) cyl(l=head_height*3/4, d=head_size, anchor=BOT, texture="trunc_ribs", tex_reps=[31,1], tex_scale=-lookup(adj_diam,rib_size)); attach(TOP) cyl(l=head_height*3/4, d=head_size, anchor=BOT, texture="trunc_ribs", tex_reps=[31,1],
tex_inset=true, tex_depth=-lookup(adj_diam,rib_size));
cyl(h=head_height,d=head_size, chamfer2=adj_diam/10, anchor=BOT); cyl(h=head_height,d=head_size, chamfer2=adj_diam/10, anchor=BOT);
} }
} }

View file

@ -1292,9 +1292,9 @@ function cylinder(h, r1, r2, center, r, d, d1, d2, anchor, spin=0, orient=UP) =
// cyl(l|h|length|height, r|d, rounding1=, rounding2=, ...); // cyl(l|h|length|height, r|d, rounding1=, rounding2=, ...);
// //
// Usage: Textured Cylinders // Usage: Textured Cylinders
// cyl(l|h|length|height, r|d, texture=, [tex_size=]|[tex_reps=], [tex_scale=], [tex_rot=], [tex_samples=], [style=], [tex_taper=], [tex_inset=], ...); // cyl(l|h|length|height, r|d, texture=, [tex_size=]|[tex_reps=], [tex_depth=], [tex_rot=], [tex_samples=], [style=], [tex_taper=], [tex_inset=], ...);
// cyl(l|h|length|height, r1=, r2=, texture=, [tex_size=]|[tex_reps=], [tex_scale=], [tex_rot=], [tex_samples=], [style=], [tex_taper=], [tex_inset=], ...); // cyl(l|h|length|height, r1=, r2=, texture=, [tex_size=]|[tex_reps=], [tex_depth=], [tex_rot=], [tex_samples=], [style=], [tex_taper=], [tex_inset=], ...);
// cyl(l|h|length|height, d1=, d2=, texture=, [tex_size=]|[tex_reps=], [tex_scale=], [tex_rot=], [tex_samples=], [style=], [tex_taper=], [tex_inset=], ...); // cyl(l|h|length|height, d1=, d2=, texture=, [tex_size=]|[tex_reps=], [tex_depth=], [tex_rot=], [tex_samples=], [style=], [tex_taper=], [tex_inset=], ...);
// //
// Usage: Caled as a function to get a VNF // Usage: Caled as a function to get a VNF
// vnf = cyl(...); // vnf = cyl(...);
@ -1364,7 +1364,7 @@ function cylinder(h, r1, r2, center, r, d, d1, d2, anchor, spin=0, orient=UP) =
// texture = A texture name string, or a rectangular array of scalar height values (0.0 to 1.0), or a VNF tile that defines the texture to apply to vertical surfaces. See {{texture()}} for what named textures are supported. // texture = A texture name string, or a rectangular array of scalar height values (0.0 to 1.0), or a VNF tile that defines the texture to apply to vertical surfaces. See {{texture()}} for what named textures are supported.
// tex_size = An optional 2D target size for the textures. Actual texture sizes will be scaled somewhat to evenly fit the available surface. Default: `[5,5]` // tex_size = An optional 2D target size for the textures. Actual texture sizes will be scaled somewhat to evenly fit the available surface. Default: `[5,5]`
// tex_reps = If given instead of tex_size, a 2-vector giving the number of texture tile repetitions in the horizontal and vertical directions. // tex_reps = If given instead of tex_size, a 2-vector giving the number of texture tile repetitions in the horizontal and vertical directions.
// tex_inset = If numeric, lowers the texture into the surface by that amount, before the tex_scale multiplier is applied. If `true`, insets by exactly `1`. Default: `false` // tex_inset = If numeric, lowers the texture into the surface by the specified proportion, e.g. 0.5 would lower it half way into the surface. If `true`, insets by exactly its full depth. Default: `false`
// tex_rot = Rotate texture by specified angle, which must be a multiple of 90 degrees. A value of true is equivalent to 90 deg, and false to 0. Default: 0 // tex_rot = Rotate texture by specified angle, which must be a multiple of 90 degrees. A value of true is equivalent to 90 deg, and false to 0. Default: 0
// tex_depth = Specify texture depth; if negative, invert the texture. Default: 1. // tex_depth = Specify texture depth; if negative, invert the texture. Default: 1.
// tex_samples = Minimum number of "bend points" to have in VNF texture tiles. Default: 8 // tex_samples = Minimum number of "bend points" to have in VNF texture tiles. Default: 8
@ -1449,7 +1449,7 @@ function cylinder(h, r1, r2, center, r, d, d1, d2, anchor, spin=0, orient=UP) =
// Example: Texturing with VNF tile "bricks_vnf" // Example: Texturing with VNF tile "bricks_vnf"
// cyl(h=50, r1=25, r2=20, shift=[0,10], rounding1=-10, // cyl(h=50, r1=25, r2=20, shift=[0,10], rounding1=-10,
// texture="bricks_vnf", tex_size=[10,10], // texture="bricks_vnf", tex_size=[10,10],
// tex_scale=0.5, style="concave"); // tex_depth=0.5, style="concave");
// //
// Example: No Texture Taper // Example: No Texture Taper
// cyl(d1=25, d2=20, h=30, rounding=5, // cyl(d1=25, d2=20, h=30, rounding=5,
@ -1487,7 +1487,7 @@ function cylinder(h, r1, r2, center, r, d, d1, d2, anchor, spin=0, orient=UP) =
// ]; // ];
// diff() // diff()
// cyl(d=20*10/PI, h=10, chamfer=0, // cyl(d=20*10/PI, h=10, chamfer=0,
// texture=tex, tex_reps=[20,1], tex_scale=-1, // texture=tex, tex_reps=[20,1], tex_depth=-1,
// tex_taper=undef, style="concave") { // tex_taper=undef, style="concave") {
// attach([TOP,BOT]) { // attach([TOP,BOT]) {
// cyl(d1=20*10/PI, d2=30, h=5, anchor=BOT) // cyl(d1=20*10/PI, d2=30, h=5, anchor=BOT)
@ -1628,7 +1628,7 @@ function cyl(
) rotate_sweep(path, ) rotate_sweep(path,
texture=texture, tex_reps=tex_reps, tex_size=tex_size, texture=texture, tex_reps=tex_reps, tex_size=tex_size,
tex_inset=tex_inset, tex_rot=tex_rot, tex_inset=tex_inset, tex_rot=tex_rot,
tex_scale=tex_scale, tex_samples=tex_samples, tex_depth=tex_depth, tex_samples=tex_samples,
tex_taper=tex_taper, style=style, closed=false tex_taper=tex_taper, style=style, closed=false
), ),
skmat = down(l/2) * skmat = down(l/2) *
@ -1709,7 +1709,7 @@ module cyl(
from_end=from_end, from_end1=from_end1, from_end2=from_end2, from_end=from_end, from_end1=from_end1, from_end2=from_end2,
teardrop=teardrop, teardrop=teardrop,
texture=texture, tex_size=tex_size, texture=texture, tex_size=tex_size,
tex_reps=tex_reps, tex_scale=tex_scale, tex_reps=tex_reps, tex_depth=tex_depth,
tex_inset=tex_inset, tex_rot=tex_rot, tex_inset=tex_inset, tex_rot=tex_rot,
style=style, tex_taper=tex_taper, style=style, tex_taper=tex_taper,
tex_samples=tex_samples tex_samples=tex_samples

View file

@ -546,7 +546,7 @@ function skin(profiles, slices, refine=1, method="direct", sampling, caps, close
// texture = A texture name string, or a rectangular array of scalar height values (0.0 to 1.0), or a VNF tile that defines the texture to apply to vertical surfaces. See {{texture()}} for what named textures are supported. // texture = A texture name string, or a rectangular array of scalar height values (0.0 to 1.0), or a VNF tile that defines the texture to apply to vertical surfaces. See {{texture()}} for what named textures are supported.
// tex_size = An optional 2D target size for the textures. Actual texture sizes will be scaled somewhat to evenly fit the available surface. Default: `[5,5]` // tex_size = An optional 2D target size for the textures. Actual texture sizes will be scaled somewhat to evenly fit the available surface. Default: `[5,5]`
// tex_reps = If given instead of tex_size, a 2-vector giving the number of texture tile repetitions in the horizontal and vertical directions on the extrusion. // tex_reps = If given instead of tex_size, a 2-vector giving the number of texture tile repetitions in the horizontal and vertical directions on the extrusion.
// tex_inset = If numeric, lowers the texture into the surface by that amount, before the tex_depth multiplier is applied. If `true`, insets by exactly `1`. Default: `false` // tex_inset = If numeric, lowers the texture into the surface by the specified proportion, e.g. 0.5 would lower it half way into the surface. If `true`, insets by exactly its full depth. Default: `false`
// tex_rot = Rotate texture by specified angle, which must be a multiple of 90 degrees. A value of true is equivalent to 90 deg, and false to 0. Default: 0 // tex_rot = Rotate texture by specified angle, which must be a multiple of 90 degrees. A value of true is equivalent to 90 deg, and false to 0. Default: 0
// tex_depth = Specify texture depth; if negative, invert the texture. Default: 1. // tex_depth = Specify texture depth; if negative, invert the texture. Default: 1.
// tex_samples = Minimum number of "bend points" to have in VNF texture tiles. Default: 8 // tex_samples = Minimum number of "bend points" to have in VNF texture tiles. Default: 8
@ -872,7 +872,7 @@ function linear_sweep(
// texture = A texture name string, or a rectangular array of scalar height values (0.0 to 1.0), or a VNF tile that defines the texture to apply to vertical surfaces. See {{texture()}} for what named textures are supported. // texture = A texture name string, or a rectangular array of scalar height values (0.0 to 1.0), or a VNF tile that defines the texture to apply to vertical surfaces. See {{texture()}} for what named textures are supported.
// tex_size = An optional 2D target size for the textures. Actual texture sizes will be scaled somewhat to evenly fit the available surface. Default: `[5,5]` // tex_size = An optional 2D target size for the textures. Actual texture sizes will be scaled somewhat to evenly fit the available surface. Default: `[5,5]`
// tex_reps = If given instead of tex_size, a 2-vector giving the number of texture tile repetitions in the direction perpendicular to extrusion and in the direction parallel to extrusion. // tex_reps = If given instead of tex_size, a 2-vector giving the number of texture tile repetitions in the direction perpendicular to extrusion and in the direction parallel to extrusion.
// tex_inset = If numeric, lowers the texture into the surface by that amount, before the tex_depth multiplier is applied. If `true`, insets by exactly `1`. Default: `false` // tex_inset = If numeric, lowers the texture into the surface by the specified proportion, e.g. 0.5 would lower it half way into the surface. If `true`, insets by exactly its full depth. Default: `false`
// tex_rot = Rotate texture by specified angle, which must be a multiple of 90 degrees. A value of true is equivalent to 90 deg, and false to 0. Default: 0 // tex_rot = Rotate texture by specified angle, which must be a multiple of 90 degrees. A value of true is equivalent to 90 deg, and false to 0. Default: 0
// tex_depth = Specify texture depth; if negative, invert the texture. Default: 1. // tex_depth = Specify texture depth; if negative, invert the texture. Default: 1.
// tex_samples = Minimum number of "bend points" to have in VNF texture tiles. Default: 8 // tex_samples = Minimum number of "bend points" to have in VNF texture tiles. Default: 8
@ -2778,7 +2778,7 @@ function associate_vertices(polygons, split, curpoly=0) =
// } // }
// stroke([[12.25,0],[12.25,2]],width=.05,endcaps="arrow2",color="black"); // stroke([[12.25,0],[12.25,2]],width=.05,endcaps="arrow2",color="black");
// move([12.35,1])color("black")text("Depth=2", size=0.3,anchor=LEFT); // move([12.35,1])color("black")text("Depth=2", size=0.3,anchor=LEFT);
// } // }
// Continues: // Continues:
// If you want to keep the texture the same size but make the slope // If you want to keep the texture the same size but make the slope
// steeper you need to add more points to make the uniform grid fine enough // steeper you need to add more points to make the uniform grid fine enough