← Back to Models
Simple Lego brick

Simple Lego brick

by dezzi ·

Just a Lego brick. Use as a foundation to extend and build complex Lego designs. Hint: you can ask to clone this brick, edit each brick with specific modifications, and distribute it on XY plane - all in a single prompt!

Interactive Preview & Customizer

3D STL viewer with browser-based OpenSCAD rendering on parameter changes.

Loading previewLoading preview...

Parameters

step 0.1
step 0.1
step 0.1
step 0.1
step 0.1
step 0.1
step 0.1
step 0.5
WASM compiler loads on first parameter change.
Download current STL

Prompt

Generate a 4x4 3d printable Lego brick

OpenSCAD Code

// 4x4 Lego-style Brick
// All dimensions in mm based on standard Lego units

// Parameters
width_units = 4;
length_units = 4;

pitch = 8.0;          // Distance between stud centers
brick_height = 9.6;   // Standard brick height
stud_radius = 2.4;    // 4.8mm diameter
stud_height = 1.8;
wall_thickness = 1.5;
internal_tube_outer = 6.51 / 2; // Outer radius of bottom tubes
internal_tube_inner = 4.8 / 2;  // Inner radius to fit studs

$fn = 64; // High resolution for round parts

module brick() {
    total_w = width_units * pitch;
    total_l = length_units * pitch;

    difference() {
        // Main block body
        cube([total_w, total_l, brick_height]);

        // Hollow out the bottom
        translate([wall_thickness, wall_thickness, -1])
            cube([total_w - wall_thickness*2, total_l - wall_thickness*2, brick_height - wall_thickness + 1]);
    }

    // Top Studs
    for (x = [0 : width_units - 1]) {
        for (y = [0 : length_units - 1]) {
            translate([x * pitch + pitch/2, y * pitch + pitch/2, brick_height])
                cylinder(h = stud_height, r = stud_radius);
        }
    }

    // Bottom Tubes (for 4x4 grid, there are 3x3 tubes)
    difference() {
        union() {
            for (x = [1 : width_units - 1]) {
                for (y = [1 : length_units - 1]) {
                    translate([x * pitch, y * pitch, 0])
                        cylinder(h = brick_height - wall_thickness, r = internal_tube_outer);
                }
            }
        }
        // Hollow out the tubes
        for (x = [1 : width_units - 1]) {
            for (y = [1 : length_units - 1]) {
                translate([x * pitch, y * pitch, -0.5])
                    cylinder(h = brick_height - wall_thickness + 1, r = internal_tube_inner);
            }
        }
    }
}

brick();