Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //monoprice maker select spool holder nut 5/20/17 12:05pm
- thread_od = 31;
- thread_step = 1.5; // Z/length distance between each thread, def 1.5
- thread_shape_degrees = 30; //smaller thread shape angles make deeper threads
- flange_z = 6; //length/thickness of flange to support the part and spool, was 2.5
- thread_z = flange_z + 2;
- ttn=round(thread_z/thread_step+2);
- st = thread_step;
- lt = thread_z;
- pf=2*3.14159265*thread_od;
- rs = 1.3; //Resolution (lower values for higher resolution, but may slow rendering)
- sn=floor(pf/rs);
- lfxy=360/sn;
- or = thread_od/2;
- lf0 = thread_shape_degrees; //step_shape_degrees
- ir=or-st/2*cos(lf0)/sin(lf0);
- zt=st/sn;
- module full_thread(ttn,st,sn,zt,lfxy,or,ir) { //thanks aubenc and mike_mattala
- if(ir >= 0.2) {
- for(i=[0:ttn-1]) {
- for(j=[0:sn-1]) {
- pt = [
- [0, 0, i*st-st ],
- [ir*cos(j*lfxy), ir*sin(j*lfxy), i*st+j*zt-st ],
- [ir*cos((j+1)*lfxy), ir*sin((j+1)*lfxy), i*st+(j+1)*zt-st ],
- [0, 0, i*st ],
- [or*cos(j*lfxy), or*sin(j*lfxy), i*st+j*zt-st/2 ],
- [or*cos((j+1)*lfxy), or*sin((j+1)*lfxy), i*st+(j+1)*zt-st/2 ],
- [ir*cos(j*lfxy), ir*sin(j*lfxy), i*st+j*zt ],
- [ir*cos((j+1)*lfxy), ir*sin((j+1)*lfxy), i*st+(j+1)*zt ],
- [0, 0, i*st+st ]
- ];
- fc = [
- [1,0,3],[1,3,6],[6,3,8],[1,6,4],
- [0,1,2],[1,4,2],[2,4,5],[5,4,6],[5,6,7],[7,6,8],
- [7,8,3],[0,2,3],[3,2,7],[7,2,5]
- ];
- polyhedron(points=pt,faces=fc);
- }
- }
- } else {
- echo("Step Degrees too agresive, the thread will not be made!!");
- echo("Try to increase de value for the degrees and/or...");
- echo(" decrease the pitch value and/or...");
- echo(" increase the outer diameter value.");
- }
- }
- module full_thread_clean() {
- difference() {
- full_thread(ttn,st,sn,zt,lfxy,or,ir);
- translate([0, 0, -10])
- cylinder(d=thread_od*2, h=20, center=true, $fn=8);
- translate([0, 0, thread_z+10])
- cylinder(d=thread_od*2, h=20, center=true, $fn=8);
- }
- }
- module flange() {
- translate([0, 0, flange_z/2])
- difference() {
- cylinder(d=42.7, h=flange_z, center=true, $fn=6);
- difference() { //round off the hex edges
- cylinder(d=42.7, h=flange_z, center=true, $fn=6);
- cylinder(d=41, h=flange_z, center=true, $fn=18);
- }
- difference() { //bevel to clone the original nut for style points
- cylinder(d=42.7, h=flange_z, center=true, $fn=6);
- cylinder(d2=42.7+18, d1=42.7-13.5, h=flange_z*2, center=true, $fn=180);
- }
- }
- }
- module positive() {
- flange();
- }
- difference() {
- translate([0, 0, flange_z])
- rotate([180, 0, 0])
- positive();
- translate([0, 0, -1])
- full_thread_clean();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement