做一个盒子,寬150毫米,高70毫米,长80毫米,壁厚3毫米,盖子和盒子用可活动的铰链连接,要求可以3d打印一体成型,给我openscad代码,代码不要出现中文
- User
做一个盒子,寬150毫米,高70毫米,长80毫米,壁厚3毫米,盖子和盒子用可活动的铰链连接,要求可以3d打印一体成型,给我openscad代码,代码不要出现中文
Assistant
Here's an OpenSCAD code for a 3D printable box with the specified dimensions (150mm width, 70mm height, 80mm length, 3mm wall thickness) and a hinged lid that can be printed in one piece:
// Parameters box_width = 150; box_length = 80; box_height = 70; wall_thickness = 3; hinge_diameter = 2; hinge_length = 10; hinge_gap = 0.5; lid_overlap = 5; clearance = 0.2; // Main box module box() { difference() { // Outer box cube([box_width, box_length, box_height]); // Inner cavity translate([wall_thickness, wall_thickness, wall_thickness]) cube([ box_width - 2 * wall_thickness, box_length - 2 * wall_thickness, box_height - wall_thickness ]); } } // Lid module lid() { difference() { // Lid base cube([box_width, box_length + lid_overlap, wall_thickness]); // Hinge cutouts for (i = [0, box_width - hinge_length]) { translate([i, -hinge_gap/2, -clearance]) cylinder(h = wall_thickness + 2*clearance, d = hinge_diameter, center = false); } } } // Hinges module hinges() { for (i = [0, box_width - hinge_length]) { translate([i, -hinge_gap/2, 0]) cylinder(h = wall_thickness, d = hinge_diameter, center = false); } } // Assembly module box_with_lid() { union() { // Box box(); // Lid with hinges translate([0, box_length - lid_overlap, box_height - wall_thickness]) lid(); // Hinge pins translate([0, box_length - lid_overlap - hinge_gap/2, box_height - wall_thickness]) hinges(); } } // Generate the model box_with_lid();This design features:
- A box with the specified dimensions (150×80×70mm) and 3mm wall thickness
- A lid that overlaps the box by 5mm
- Two hinges (one on each side) that allow the lid to open and close
- The entire assembly is designed to be 3D printed in one piece
- The hinges have small gaps to allow movement after printing
You may need to adjust the hinge parameters (diameter, length, gap) based on your specific 3D printer's capabilities and the material you're using. The clearance value can also be adjusted if the hinges are too tight or too loose after printing.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.