Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Reddit request:
- // https://www.reddit.com/r/3Drequests/comments/1kiwq2f/request_to_make_a_model/
- //
- // Open the "Customizer" window in OpenSCAD,
- // then use the sliders.
- //
- // Version 1, CC0
- // Accuracy, higher is more accurate and slower.
- $fn = 100; // [10:200]
- // The diameter of the tubes.
- tube_diameter = 8; // [3:15]
- // The number of tubes.
- number_tubes = 4; // [1:10]
- // The tubes overlap each other a little.
- tube_overlap = 2; // [0:5]
- // The offset start of the first tube.
- tube_start = 5; // [0:0.1:20]
- // The gap width for the switch.
- gap_width = 18; // [3:30]
- // The gap height for the switch.
- gap_height = 50; // [10:100]
- // The radius of the round corner of the gap.
- gap_corner = 1; // [0:5]
- // How much of the bottom is removed.
- bottom_start = 1; // [0:10]
- // Add the gap for the switch.
- // Remove some from the bottom.
- difference()
- {
- CoverNoGap();
- linear_extrude(100,center=true)
- SquareGap2D();
- // Some of the bottom is removed.
- // The size of the cube that is used
- // is a don't care, it should be
- // large enough.
- translate([0,0,-200-tube_diameter/2+bottom_start])
- cube(400,center=true);
- }
- module CoverNoGap()
- {
- // The two circular tubes.
- for(m=[0,1])
- mirror([0,m,0])
- translate([0,gap_height/2,0])
- CircularTubes();
- // The parallel tubes.
- for(m=[0,1])
- mirror([m,0,0])
- ParalelTubes();
- Base();
- }
- module Base()
- {
- // Put a base under it.
- radius = tube_start
- + number_tubes*tube_diameter
- - (number_tubes-1)*tube_overlap
- - tube_diameter/2;
- translate([0,0,-tube_diameter/2])
- linear_extrude(tube_diameter/2)
- hull()
- for(m=[0,1])
- mirror([0,m,0])
- translate([0,gap_height/2,0])
- circle(radius);
- }
- module ParalelTubes()
- {
- delta = tube_diameter - tube_overlap;
- for(i=[0:number_tubes-1])
- translate([tube_start + i*delta,0,0])
- rotate([90,0,0])
- cylinder(h=gap_height,d=tube_diameter,center=true);
- }
- module CircularTubes()
- {
- delta = tube_diameter - tube_overlap;
- for(i=[0:number_tubes-1])
- HalfTorus(tube_start + i*delta);
- }
- // Create half a torus.
- // In the direction of the y-axis.
- // The center of the tube starts at [x,0].
- module HalfTorus(x)
- {
- rotate_extrude(180)
- translate([x,0])
- circle(d=tube_diameter);
- }
- module SquareGap2D()
- {
- // give it round corners with offset().
- offset(gap_corner)
- offset(-gap_corner)
- square([gap_width,gap_height],center=true);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement