基於OpenSCAD(http://www.openscad.org/)的一個盒子造型,能夠用於瞭解OpenSCAD的3D造型語言。php
這個盒子的尺寸是爲WRTnode(http://wrtnode.com/)設計的,能夠輸出STL後經過3D打印機打印出來直接使用(注意:不一樣3D打印機的輸出效果和間歇、材料收縮的公差不一樣,請自行根據狀況調整,不然組裝不上喔!)。node
WRTnode(http://wiki.wrtnode.com/index.php?title=Main_Page/zh-cn)是一個開源的智能路由器開發板,能夠運行OpenWRT開源智能路由器操做系統,功能至關的強大。該系統是基於Linux內核的,不少Linux程序均可以運行,還支持Python和LUA腳本,也能夠將該固件刷到不少市售的家用路由器上,從而加強其功能。目前在售的極路由、小米路由等智能路由都是基於OpenWRT定製而成。shell
原始的OpenSCAD代碼以下:spa
//WRTnode智能路由器,盒子,防雨淋型(垂直安裝) //Author:openthings@163.com, //copyright 2015-2025. //打印時注意比例變化,而且旋轉向上。 //避免上部打印時無支撐塌陷。 //蓋子單獨打印,或放爲兩個模型。 /*Changelog: V1.1,2015-02-27: 一、盒蓋的USB接口向Y偏移0.2,更好適應WRTnode的接口。 二、盒蓋總體尺寸長寬減小0.2,以方便組裝。 三、盒蓋的偏移量和進風口相應調整。 四、盒蓋的擋格向內移0.1,使蓋子能徹底嵌入盒體。 */ //常量定義 athick=0.5; //蓋子厚度 bthick=0.10; //盒壁厚度 bwidth=5.0; //內徑淨寬 bhight=1.8; //內徑淨高 blong_inter=5.5;//內徑淨長 //外徑長度=底厚+內徑+擋格+蓋子厚度 blong=bthick+blong_inter+bthick+athick; //文字或圖標標識 //translate([-2,0,0]) //scale([1, 1, 0.1]) // surface(file = "smiley.png", center = true); //====================================== //盒子體,採用挖空切割方式造型。 difference() { //外盒 translate([0,0,0]) { color([0.8,0.8,0.8]) cube([blong,bwidth+bthick*2, bhight+bthick*2]); } //內盒,挖空。 translate([bthick,bthick,bthick]) { color([0.2,0.8,0.8]) cube([blong+1,bwidth,bhight]); } //底部,凹陷標識。 translate([blong-2,2.2,bhight+bthick+0.08]) { color([0.2,0.2,0.2]) cube([1.5,bwidth*0.5,0.1]); } } //底部增強,在內部造成邊角擋格。 translate([bthick,bthick,bthick]) { color([0.2,0.5,0.2]) cube([bthick,bwidth,bthick]); } translate([bthick,bthick,bhight]) { color([0.2,0.5,0.2]) cube([bthick,bwidth,bthick]); } translate([bthick,bthick,bthick]) { color([0.2,0.5,0.2]) cube([bthick,bthick,bhight]); } translate([bthick,bwidth,bthick]) { color([0.2,0.5,0.2]) cube([bthick,bthick,bhight]); } //蓋子擋格。 translate([blong-athick-0.1,bthick,bthick]) { color([0.2,0.5,0.2]) cube([bthick,bwidth,bthick]); } translate([blong-athick-0.1,bthick,bhight]) { color([0.2,0.5,0.2]) cube([bthick,bwidth,bthick]); } //====================================== //蓋子,單獨打印。嵌入盒子內部,注意留公差。 //translate([2,0.0,0.0]){ translate([0,0.05,2.55]){ difference() { //蓋子,挖空。 translate([0,bthick,bthick]) { color([0.5,0.5,0.5]) cube([athick-0.05,bwidth-0.1,bhight-0.1]); } translate([0.2,bthick*2,bthick*2]) { color([0.6,0.3,0.8]) cube([athick+1,bwidth-bthick*2-0.1, bhight-bthick*2-0.1]); } //通風口,挖空。================ //左側出風口 translate([-0.1,0.5,1.2]) { color([1,0.8,0.8]) cube([0.8,1.5,0.2]); } translate([-0.1,0.5,0.85]) { color([1,0.8,0.8]) cube([0.8,1.5,0.2]); } translate([-0.1,0.5,0.5]) { color([1,0.8,0.8]) cube([0.8,1.5,0.2]); } //右側進風口 translate([-0.1,3.2,0.5]) { color([1,0.8,0.8]) cube([0.8,0.8,0.4]); } translate([-0.1,4.2,0.5]) { color([1,0.8,0.8]) cube([0.8,0.2,0.9]); } translate([-0.1,4.6,0.5]) { color([1,0.8,0.8]) cube([0.8,0.2,0.9]); } //USB接口,挖空。 translate([-0.1,3.2,1.10]) { color([1,0.8,0.8]) cube([0.8,0.8,0.3]); } } }