Corrner block and fixing block assemblies now more flexible.

Can split the fasteners between assemblies and omit the star washers.
This commit is contained in:
Chris Palmer 2019-08-18 12:36:13 +01:00
parent b8dba626d2
commit 566cbce98f
3 changed files with 37 additions and 22 deletions

View File

@ -57,8 +57,8 @@ module corner_block_v_hole(screw = def_screw) //! Place children at the bottom s
multmatrix(corner_block_v_hole(screw))
children();
module corner_block_h_holes(screw = def_screw) //! Place children at the side screw holes
for(p = corner_block_h_holes(screw))
module corner_block_h_holes(screw = def_screw, index = undef) //! Place children at the side screw holes
for(p = !is_undef(index) ? [corner_block_h_holes(screw)[index]] : corner_block_h_holes(screw))
multmatrix(p)
children();
@ -126,22 +126,33 @@ assembly(str("corner_block_M", 20 * screw_radius(screw))) {
insert(insert);
}
module fastened_corner_block_assembly(thickness, screw = def_screw, thickness_below = undef, name = false) { //! Printed block with all fasteners
module fastened_corner_block_assembly(thickness, screw = def_screw, thickness_below = undef, thickness_side2 = undef, name = false, show_block = true, star_washers = true) { //! Printed block with all fasteners
thickness2 = !is_undef(thickness_below) ? thickness_below : thickness;
thickness3 = !is_undef(thickness_side2) ? thickness_side2 : thickness;
washer = screw_washer(screw);
insert = screw_insert(screw);
screw_length = screw_shorter_than(2 * washer_thickness(washer) + thickness + insert_length(insert) + overshoot);
function screw_length(t) = screw_shorter_than((star_washers ? 2 : 1) * washer_thickness(washer) + t + insert_length(insert) + overshoot);
screw_length = screw_length(thickness);
screw_length2 = screw_length(thickness2);
screw_length3 = screw_length(thickness3);
corner_block_assembly(screw, name) children();
if(show_block)
corner_block_assembly(screw, name) children();
corner_block_h_holes(screw)
translate_z(thickness)
screw_and_washer(screw, screw_length, true);
if(thickness)
corner_block_h_holes(screw, 0)
translate_z(thickness)
screw_and_washer(screw, screw_length, star_washers);
thickness2 = thickness_below ? thickness_below : thickness;
screw_length2 = screw_shorter_than(2 * washer_thickness(washer) + thickness2 + insert_length(insert) + overshoot);
corner_block_v_hole(screw)
translate_z(thickness2)
screw_and_washer(screw, screw_length2, true);
if(thickness3)
corner_block_h_holes(screw, 1)
translate_z(thickness3)
screw_and_washer(screw, screw_length3, star_washers);
if(thickness2)
corner_block_v_hole(screw)
translate_z(thickness2)
screw_and_washer(screw, screw_length2, star_washers);
}
module corner_block_M20_stl() corner_block(M2_cap_screw);

View File

@ -116,20 +116,24 @@ assembly(str("fixing_block_M", 20 * screw_radius(screw))) {
insert(insert);
}
module fastened_fixing_block_assembly(thickness, screw = def_screw, screw2 = undef, thickness2 = undef) { //! Assembly with fasteners in place
module fastened_fixing_block_assembly(thickness, screw = def_screw, screw2 = undef, thickness2 = undef, show_block = true, star_washers = true) { //! Assembly with fasteners in place
module fb_screw(screw, thickness) {
washer = screw_washer(screw);
insert = screw_insert(screw);
screw_length = screw_longer_than(2 * washer_thickness(washer) + thickness + insert_length(insert));
screw_length = screw_longer_than((star_washers ? 2 : 1) * washer_thickness(washer) + thickness + insert_length(insert));
translate_z(thickness)
screw_and_washer(screw, screw_length, true);
if(thickness)
translate_z(thickness)
screw_and_washer(screw, screw_length, star_washers);
}
no_pose() fixing_block_assembly(screw);
if(show_block)
no_pose()
fixing_block_assembly(screw);
t2 = !is_undef(thickness2) ? thickness2 : thickness;
fixing_block_v_holes(screw)
fb_screw(screw, thickness2 ? thickness2 : thickness);
fb_screw(screw, t2);
fixing_block_h_hole(screw)
fb_screw(screw2 ? screw2 : screw, thickness);

View File

@ -3338,10 +3338,10 @@ Note that the block with its inserts is defined as a sub assembly, but its faste
|:--- |:--- |
| ```corner_block(screw = def_screw, name = false)``` | Generate the STL for a printed corner block |
| ```corner_block_assembly(screw = def_screw, name = false)``` | The printed block with inserts |
| ```corner_block_h_holes(screw = def_screw)``` | Place children at the side screw holes |
| ```corner_block_h_holes(screw = def_screw, index = undef)``` | Place children at the side screw holes |
| ```corner_block_holes(screw = def_screw)``` | Place children at all the holes |
| ```corner_block_v_hole(screw = def_screw)``` | Place children at the bottom screw hole |
| ```fastened_corner_block_assembly(thickness, screw = def_screw, thickness_below = undef, name = false)``` | Printed block with all fasteners |
| ```fastened_corner_block_assembly(thickness, screw = def_screw, thickness_below = undef, thickness_side2 = undef, name = false, show_block = true, star_washers = true)``` | Printed block with all fasteners |
![corner_block](tests/png/corner_block.png)
@ -3549,7 +3549,7 @@ Note that the block with its inserts is defined as a sub assembly, but its faste
### Modules
| Module | Description |
|:--- |:--- |
| ```fastened_fixing_block_assembly(thickness, screw = def_screw, screw2 = undef, thickness2 = undef)``` | Assembly with fasteners in place |
| ```fastened_fixing_block_assembly(thickness, screw = def_screw, screw2 = undef, thickness2 = undef, show_block = true, star_washers = true)``` | Assembly with fasteners in place |
| ```fixing_block(screw = def_screw)``` | Generate the STL |
| ```fixing_block_assembly(screw = def_screw)``` | Printed part with the inserts inserted |
| ```fixing_block_h_hole(screw = def_screw)``` | Position children on the horizontal hole |