/************************************************************************************* * * Cylindric Container With Center Pole And Overlapped Lid. * ************************************************************************************* * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHOR OR COPYRIGHT * HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * * IT IS NOT PERMITTED TO MODIFY THIS COMMENT BLOCK. * * (c)2023, Claude "Tryphon" Theroux, Montreal, Quebec, Canada * http://www.ctheroux.com/ * ************************************************************************************/ // Set it to lid, body or both Generate = "both"; // Inner diameter of the container in mm InnerDiameter = 50; // Inner height of the container in mm InnerHeight = 10; // Center pole diameter in mm CenterPoleDiameter = 6.5; // Wall tickness in mm WallThickness = 1.2; // Inner lid height in mm excluding the wall thickness InnerLidHeight = 5; // Lid tolerance in mm LidClearance = 0.03; // Container tolerance in mm. It will be added to the // InnerDiameter and InnerHeight. ContainerTolerance = 1; // Air vent hole diameter in mm AirVentHoleDiameter = 1.5; // Distance between lid and body in mm BodyLidDistance = 10; //////////////////////////////////////////////////////////////// // // Computed values. Nothing should be modified below this line. // $fn = 60; module GenerateBody() { union() { difference() { cylinder(h = InnerHeight + WallThickness + ContainerTolerance, d = InnerDiameter + 2 * WallThickness + ContainerTolerance); translate([0, 0, WallThickness]) cylinder(h = InnerHeight + ContainerTolerance, d = InnerDiameter + ContainerTolerance); } translate([0, 0, WallThickness]) cylinder(h = InnerHeight + ContainerTolerance, d = CenterPoleDiameter); } } module GenerateLid(pBearingDefinition) { difference() { cylinder(h = InnerLidHeight + WallThickness, d = InnerDiameter + 4 * WallThickness + ContainerTolerance); translate([0, 0, WallThickness]) cylinder(h = InnerLidHeight, d = InnerDiameter + 2 * WallThickness + ContainerTolerance + LidClearance); translate([CenterPoleDiameter + ContainerTolerance, 0, 0]) cylinder(h = WallThickness, d = AirVentHoleDiameter); } } if( Generate == "body" ) { GenerateBody(); } else if ( Generate == "lid" ) { GenerateLid(); } else if ( Generate == "both" ) { GenerateBody(); translate([ InnerDiameter + WallThickness + BodyLidDistance, 0, 0]) GenerateLid(); } else { assert(false, str("ERROR: Invalid Generate value ", Generate)); }