Add round model

This commit is contained in:
Przemek Grondek 2022-01-31 22:45:13 +01:00
parent ca9d4eb737
commit 15617f0311

View File

@ -16,7 +16,7 @@ block_length = 6;
block_height_ratio = 1; // [.33333333333:1/3, .5:1/2, 1:1, 2:2, 3:3, 4:4, 5:5, 6:6, 7:7, 8:8, 9:9, 10:10]
// What type of block should this be? For type-specific options, see the "Wings," "Slopes," "Curves", and "Baseplates" tabs.
block_type = "center"; // [brick:Brick, tile:Tile, wing:Wing, slope:Slope, curve:Curve, baseplate:Baseplate, center:Center Stud]
block_type = "round"; // [brick:Brick, tile:Tile, wing:Wing, slope:Slope, curve:Curve, baseplate:Baseplate, center:Center Stud]
// What brand of block should this be? LEGO for regular LEGO bricks, Duplo for the toddler-focused larger bricks.
block_brand = "lego"; // [lego:LEGO, duplo:DUPLO]
@ -270,13 +270,34 @@ module block(
*/
// The mass of the block.
difference() {
cube([overall_length, overall_width, real_height * block_height]);
translate([wall_thickness,wall_thickness,-roof_thickness]) cube([overall_length-wall_thickness*2,overall_width-wall_thickness*2,block_height*real_height]);
if( type != "round") {
difference() {
cube([overall_length, overall_width, real_height * block_height]);
translate([wall_thickness,wall_thickness,-roof_thickness]) cube([overall_length-wall_thickness*2,overall_width-wall_thickness*2,block_height*real_height]);
}
} else {
difference() {
translate([(overall_length*stud_rescale)/2,(overall_length*stud_rescale)/2])
cylinder(r=(overall_length*stud_rescale)/2,h=real_height * block_height,$fs=cylinder_precision);
translate([(overall_length*stud_rescale)/2,(overall_length*stud_rescale)/2, -roof_thickness])
cylinder(r=(overall_length*stud_rescale-wall_thickness)/2,h=real_height * block_height,$fs=cylinder_precision);
translate([stud_diameter * stud_rescale / 2, stud_diameter * stud_rescale / 2, 0])
translate([(overall_length - total_studs_length)/2, (overall_width - total_studs_width)/2, 0]) {
for (ycount=[0:real_width-1]) {
for (xcount=[0:real_length-1]) {
if (!skip_this_stud(xcount, ycount)) {
translate([xcount*stud_spacing,ycount*stud_spacing,0]) stud();
}
}
}
}
}
}
// The studs on top of the block (if it's not a tile).
if ( type != "tile" && type != "center" && !real_dual_bottom ) {
if ( type != "tile" && type != "center" && !real_dual_bottom && type != "round") {
translate([stud_diameter * stud_rescale / 2, stud_diameter * stud_rescale / 2, 0])
translate([(overall_length - total_studs_length)/2, (overall_width - total_studs_width)/2, 0]) {
for (ycount=[0:real_width-1]) {
@ -288,13 +309,33 @@ module block(
}
}
}
// Round
else if (type == "round") {
difference() {
translate([stud_diameter * stud_rescale / 2, stud_diameter * stud_rescale / 2, 0])
translate([(overall_length - total_studs_length)/2, (overall_width - total_studs_width)/2, 0]) {
for (ycount=[0:real_width-1]) {
for (xcount=[0:real_length-1]) {
if (!skip_this_stud(xcount, ycount)) {
translate([xcount*stud_spacing,ycount*stud_spacing,block_height*real_height]) stud();
}
}
}
}
difference () {
translate([(overall_length*stud_rescale)/2,(overall_length*stud_rescale)/2, block_height*real_height])
cylinder(r=(overall_length*stud_rescale)/2+5,h=real_height * block_height,$fs=cylinder_precision);
translate([(overall_length*stud_rescale)/2,(overall_length*stud_rescale)/2, block_height*real_height])
cylinder(r=(overall_length*stud_rescale)/2,h=real_height * block_height,$fs=cylinder_precision);
}
}
}
// Center Stud
if (type == "center"){
else if (type == "center"){
translate([axle_diameter / 2, axle_diameter / 2, 0]) {
translate([(overall_length - total_axles_length)/2, (overall_width - total_axles_width)/2, 0]) {
ycount = (real_width )/2;
xcount = (real_length)/2;
translate([(xcount-1)*stud_spacing,(ycount-1)*stud_spacing,block_height*real_height]) stud("hollow");
}
}
}