Zhang Yuexin

C# programmer. Know a bit of hardware knowledge. 3D model design novice.

张高兴 - 土味儿编程

高兴不高兴

OpenSCAD 建模:矿泉水瓶花洒

本文约 350 字,包含 1 张图片,1 个代码段,阅读时间约 2 分钟
QR Code

在手机上查看此页面


下载地址:https://github.com/ZhangGaoxing/openscad-models/tree/master/Sprinkle

代码:

module screw(r=15){
    for(g=[0:1:240]){
        translate([cos(g)*r,sin(g)*r,(g)/40])
        rotate(a=[93,60,g])
        cylinder(.6,.6,.6,center=true,$fn=3);
    }
}

module cylinderWithScrew(){
    union(){
        // Cylinder shell
        difference(){
            cylinder(28,16.5,16.5,$fn=200);
            cylinder(28,15.5,15.5,$fn=200);
        }

        // Screw
        union(){
            translate([0,0,19])screw(15);
            translate([0,0,19])rotate([0,0,120])screw(15);
            translate([0,0,19])rotate([0,0,240])screw(15);
        }
    }
}

module sprinklerWall(){
    difference(){
        cylinder(35,35,16.5,$fn=200);
        cylinder(35,33.5,15.5,$fn=200);
        
        rotate([90,0,0])translate([0,22,18])cylinder(18,1.5,1.5,$fn=200);
    }
}

module sprinklerBottom(){
    difference(){
        cylinder(1,35,35,$fn=200);

        cylinder(2,1,1,$fn=200);

        for(i=[0:0.2:0.8]){
            rotate(i*360/0.8,[0,0,1])
            translate([0,6,0])
            cylinder(2,1,1,$fn=200);
        }

        for(i=[0:0.2:1.6]){
            rotate(i*360/1.6,[0,0,1])
            translate([0,12,0])
            cylinder(2,1,1,$fn=200);
        }

        for(i=[0:0.2:2.4]){
            rotate(i*360/2.4,[0,0,1])
            translate([0,18,0])
            cylinder(2,1,1,$fn=200);
        }

        for(i=[0:0.2:3.2]){
            rotate(i*360/3.2,[0,0,1])
            translate([0,24,0])
            cylinder(2,1,1,$fn=200);
        }
        
        for(i=[0:0.2:4]){
            rotate(i*360/4,[0,0,1])
            translate([0,30,0])
            cylinder(2,1,1,$fn=200);
        }
    }
}

union(){
    sprinklerBottom();
    translate([0,0,1])sprinklerWall();
    translate([0,0,36])cylinderWithScrew();
}

效果图:

最后更新时间 : 2017/07/08 19:46 张高兴 阅读(293) 评论(0)
文章分类: OpenSCAD 建模
文章标签: OpenSCAD
  发表评论
Click to Refresh