Skip to content

OpenSCAD Bed STL Generation

The below OpenSCAD script can be used (with your values added) to generate an appropriate STL for PrusaSlicer/SuperSlicer.

  • With 'isSquare' set to 'true', the Exclusion areas will be squares that remove the area between the points specified in 'xNoGo' and 'yNoGo'.

    Square Cutouts

  • With 'isSquare' set to 'false', the Exclusion area will be triangular.

    Triangular Cutouts

Tip

You can use this site to generate your bed STL if you don't want to install OpenSCAD.

bedGenerator.scad
xMax = 355; // Size of your bed in millimeters for X
yMax = 355; // Size of your bed in millimeters for Y
zHeight = 8; // Size of your bed in millimeters for thickness
xNoGo = 35; // The exclusion area size in X
yNoGo = 30; // The exclusion area size in Y
isSquare = true; // Change to false for triangles

// DON'T CHANGE BELOW HERE
eps = 0.01; // Epsilon (https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/CSG_Modelling#union)
xExclusion = xNoGo+eps;
yExclusion = yNoGo+eps;

module triangle(o_len, a_len, depth, center=false)
{
    centroid = center ? [-a_len/3, -o_len/3, -depth/2] : [0, 0, 0];
    translate(centroid) linear_extrude(height=depth)
    {
        polygon(points=[[0,0],[a_len,0],[0,o_len]], paths=[[0,1,2]]);
    }
}

if (isSquare){
    difference(){
        cube([xMax,yMax,zHeight]);
        translate([-eps,-eps,-eps])
            cube([xExclusion,yExclusion,zHeight+(2*eps)]);
        translate([xMax-xExclusion+eps,-eps,-eps])
            cube([xExclusion,yExclusion,zHeight+(2*eps)]);
    }
}

else {
    union(){ 
        difference(){
            cube([xMax/2,yMax,zHeight]);
            translate([-eps,-eps,-eps])
                triangle(xExclusion,yExclusion,zHeight+(2*eps));
        }
        mirror([1,0,0])
            translate([-xMax,0,0])
                difference(){
                    cube([xMax/2,yMax,zHeight]);
                    translate([-eps,-eps,-eps])
                        triangle(xExclusion,yExclusion,zHeight+(2*eps));
                }
    }
}