Below is one example of an OpenSCAD script that “builds” a two‐level enclosure. In our design the lower compartment is sized to host the “36V7A‑PLUS” AC–DC board (approximately 110–120 mm wide by 70–80 mm deep by about 30–35 mm high) while the upper compartment is sized for the DPS5020 board and its “display” (a front‐cut rectangular window). In addition, there is a circular “fan” hole in the bottom face (for air intake) and one in the top face (for exhaust). A thin internal horizontal “partition” (with an opening so that air may pass upward) separates the lower and upper cavities. (Adjust the numbers as needed to match your actual boards.)
Below is the complete code. (You can copy–paste it into OpenSCAD and render.)
// ================================
// DPS5020 Box with AC–DC Converter, Fan cutouts, display window and internal partition
// Designed for a two‐level layout:
// • The bottom (lower) compartment holds the AC/DC board (36V7A-PLUS).
// • The upper compartment holds the DPS5020 board with a front “display” window.
// • Air is drawn in from the bottom fan hole and exhausted at the top.
// • A partition (with an opening) divides the two cavities.
// Adjust all parameters as needed for your parts.
// ================================
// Parameters for wall thickness and internal cavity sizes:
thickness = 3; // wall thickness (mm)
internal_width = 120; // internal width (mm) – must allow the AC–DC and DPS boards to fit.
internal_depth = 90; // internal depth (mm)
lower_h = 50; // internal height allocated for the AC/DC board (plus clearance)
upper_h = 40; // internal height for the DPS5020 board + display window clearance
partition_h = 3; // thickness of the horizontal partition between levels
// Overall outer dimensions:
outer_width = internal_width + 2*thickness;
outer_depth = internal_depth + 2*thickness;
outer_height = lower_h + partition_h + upper_h + 2*thickness;
// Display (front cutout) parameters for the DPS5020 front panel:
display_width = 60; // width of display window (mm)
display_height = 20; // height of display window (mm)
// ----------------------------------------------------------------------
// Module: box_shell()
// This builds the outer “shell” by subtracting an internal cavity from an outer cube.
// The cavity dimensions are chosen so that when boards are mounted inside, they are
// surrounded by solid material.
module box_shell() {
difference() {
// Outer solid:
cube([outer_width, outer_depth, outer_height]);
// Remove the internal cavity:
translate([thickness, thickness, thickness])
cube([internal_width, internal_depth, lower_h + partition_h + upper_h]);
}
}
// ----------------------------------------------------------------------
// Module: partition()
// This creates the horizontal partition between the two compartments.
// A circular “vent” (hole) is subtracted so that air can circulate upward.
module partition() {
difference() {
// The solid partition is located at the top of the lower cavity:
translate([thickness, thickness, thickness + lower_h])
cube([internal_width, internal_depth, partition_h]);
// Subtract a circular opening (vent) in the partition:
translate([ outer_width/2, outer_depth/2, thickness + lower_h ])
cylinder(h = partition_h + 1, r = 15, center = false, $fn = 50);
}
}
// ----------------------------------------------------------------------
// Module: fan_hole_bottom()
// A circular cutout in the bottom face (air intake).
module fan_hole_bottom() {
translate([outer_width/2, outer_depth/2, 0])
cylinder(h = thickness + 1, r = 20, center = false, $fn = 50);
}
// ----------------------------------------------------------------------
// Module: fan_hole_top()
// A circular cutout in the top face (exhaust).
module fan_hole_top() {
translate([outer_width/2, outer_depth/2, outer_height - thickness])
cylinder(h = thickness + 1, r = 20, center = false, $fn = 50);
}
// ----------------------------------------------------------------------
// Module: display_cutout()
// This creates a rectangular window in the front (y = 0 face) of the upper compartment.
// It is centered horizontally and vertically in the upper internal space.
module display_cutout() {
// Compute the Z position so that the cutout sits roughly at the center of the upper compartment.
z_offset = thickness + lower_h + (upper_h - display_height)/2;
// The cube is extruded a bit so that it cuts completely through the front wall.
translate([ outer_width/2 - display_width/2, -1, z_offset ])
cube([ display_width, thickness + 2, display_height ]);
}
// ----------------------------------------------------------------------
// Assemble the complete model:
// 1. Build the shell.
// 2. "Embed" the partition inside the cavity.
// 3. Subtract the fan cutouts (top and bottom) as well as the display cutout.
difference() {
// Add the outer shell and the internal partition.
union() {
box_shell();
partition();
}
// Remove material for the fan holes and display window:
fan_hole_bottom();
fan_hole_top();
display_cutout();
}
Explanation
-
Parameters:
Adjust the four main groups of parameters:
- Enclosure and wall thickness: the overall internal and outer dimensions are defined by
internal_width, internal_depth, lower_h, upper_h, and thickness.
- Partition: is given a thickness of
partition_h and a circular vent (a 15 mm radius opening) is created in it.
- Fan holes: two circular holes (each with a 20 mm radius) are subtracted from the bottom and top faces.
- Display cutout: a rectangular front window (60 mm wide × 20 mm high) is removed from the front wall of the upper compartment.
-
Modules:
Each module builds a part of the assembly. The main body is built with box_shell(), and the internal structure (the partition) is added with partition(). The difference() at the end subtracts the fan/vent holes and the display window cutout.
-
Internal Layout Assumptions:
The lower compartment is intended for the AC–DC “36V7A‑PLUS” board (whose typical dimensions you should double–check against your purchased parts). The upper compartment houses the DPS5020 board and the visible display window.
-
Airflow:
With a fan inlet on the bottom and an aligned exhaust on the top and a vented partition, air will be drawn in from the bottom and flow upward, cooling both boards inside.
Feel free to modify dimensions and shapes (for example, fillets, mounting bosses, etc.) to suit your printed–part or metal–fabrication methods.
Happy designing!