這次結合了OpenSCAD和Thingiverse裡的Customizer,讓我們的設計的參數模型能夠開放給其他人做創作.
----------------------------------------
這次我做了一個參數作品,剛開始的想法是設計一款客製化的杯子,能夠讓使用者在Thingivers上做設計,然後輸出成stl檔,再利用陶瓷的3D列印去成型,後來在過程中發現出其他的可能性像是筆筒.戒指.....環形的東西都可以做設計,就看使用者如何去設定參數
下面我會從OpenSCAD的建模到如何上傳至Thingiverse上做教學
----------------------------------------
一開始一定要熟悉的介面
大塊空白的地方是寫coding的欄位,右邊是檔案資訊,包含整個檔案的大小;當程式出錯時也會顯示在這邊,下面有軸向的就是模型render出來的地方摟~
操作說明: 左鍵 - 旋轉
右鍵 - 平移
滾輪 - 縮放
----------------------------------------
----------------------------------------
操作說明: 左鍵 - 旋轉
右鍵 - 平移
滾輪 - 縮放
----------------------------------------
----------------------------------------
介面介紹完了~要開始建模了~
我先將所有程式碼上傳,再一步步講解
CupHeight =100;
TwistDegree=90;
TheSlices=10;
FilletOutside=5;
FilletInside=10;
OutsideSides=4;
InsideSides=10;
OutsideRadius=20;
InsideRadius=5;
ButtomThinkness=0;
module outsideshell(){
linear_extrude(height=CupHeight,twist=TwistDegree,slices=TheSlices){
offset(r=FilletOutside){
translate([0,0]) circle(OutsideRadius,$fn=OutsideSides);
}
}
}
module insideshell(){
linear_extrude(height=CupHeight,twist=TwistDegree,slices=TheSlices){
offset(r = FilletInside) {
translate([0,0]) circle(InsideRadius,$fn=InsideSides);
}
}
}
difference(){
translate([0,0,0]){ outsideshell();}
translate([0,0,ButtomThinkness]) {insideshell();}
}
----------------------------------------
我先將所有程式碼上傳,再一步步講解
CupHeight =100;
TwistDegree=90;
TheSlices=10;
FilletOutside=5;
FilletInside=10;
OutsideSides=4;
InsideSides=10;
OutsideRadius=20;
InsideRadius=5;
ButtomThinkness=0;
module outsideshell(){
linear_extrude(height=CupHeight,twist=TwistDegree,slices=TheSlices){
offset(r=FilletOutside){
translate([0,0]) circle(OutsideRadius,$fn=OutsideSides);
}
}
}
module insideshell(){
linear_extrude(height=CupHeight,twist=TwistDegree,slices=TheSlices){
offset(r = FilletInside) {
translate([0,0]) circle(InsideRadius,$fn=InsideSides);
}
}
}
difference(){
translate([0,0,0]){ outsideshell();}
translate([0,0,ButtomThinkness]) {insideshell();}
}
----------------------------------------
建模順序: 草圖1-長出草圖1-草圖2-長出草圖2-用零件2剪裁零件1
首先前面這些參數要先定義好,這樣上傳到Thingivers上才會知道控制的是哪個參數
* 如果要讓字體在Thingiverse上面有間隔,記得要讓空格後的字母變成大寫,不然字都會連在一起(版面也是很重要的)
CupHeight =100;
TwistDegree=90;
TheSlices=10;
FilletOutside=5;
FilletInside=10;
OutsideSides=4;
InsideSides=10;
OutsideRadius=20;
InsideRadius=5;
ButtomThinkness=0;

translate([0,0]) circle(InsideRadius,$fn=InsideSides);
用translate()來定位模型的中心點,再來用circle()做形狀的變化
translate([0,0,0])
=>translate([x,y,z])
circle( InsideRadius, $fn=InsideSides);
=>circle( 外接圓半徑 , 正多邊形邊數);
在圖形外面加上offset() { } 設定多邊形的圓角
首先前面這些參數要先定義好,這樣上傳到Thingivers上才會知道控制的是哪個參數
* 如果要讓字體在Thingiverse上面有間隔,記得要讓空格後的字母變成大寫,不然字都會連在一起(版面也是很重要的)
CupHeight =100;
TwistDegree=90;
TheSlices=10;
FilletOutside=5;
FilletInside=10;
OutsideSides=4;
InsideSides=10;
OutsideRadius=20;
InsideRadius=5;
ButtomThinkness=0;

translate([0,0]) circle(InsideRadius,$fn=InsideSides);
用translate()來定位模型的中心點,再來用circle()做形狀的變化
translate([0,0,0])
=>translate([x,y,z])
circle( InsideRadius, $fn=InsideSides);
=>circle( 外接圓半徑 , 正多邊形邊數);
在圖形外面加上offset() { } 設定多邊形的圓角
offset(r = FilletInside)
=>offset(r = 圓角半徑)
----------------------------------------
=>offset(r = 圓角半徑)
----------------------------------------
linear_extrude(height=CupHeight,twist=TwistDegree,slices=TheSlices)
=>linear_extrude(長出高度,旋轉角度,層數) *層數越高,模型就越細緻
再來將剛剛建好的3D模型帶入到 module outsideshell(){ } 以後需要這個模型就不必再重新輸入一次程式碼,只要輸入 outsideshell(); 就可以把模型叫出來,是不是很方便啊!
----------------------------------------
再重複上面的步驟,做出外面的模型,記得參數要做修改喔~
然後利用 difference(){ } 將兩個模型進行布林運算,

difference(){
translate( [0,0,0] ){ outsideshell(); }
translate( [0,0,ButtomThinkness] ) { insideshell(); }
}
放在第一個是被修剪的模型,而後面則是要修剪的模型,這樣就大功告成摟~~YA
*我在第二個模型的translate()上加入Z軸的變化,讓使用者自己去設計要不要把底封起來
=>linear_extrude(長出高度,旋轉角度,層數) *層數越高,模型就越細緻
再來將剛剛建好的3D模型帶入到 module outsideshell(){ } 以後需要這個模型就不必再重新輸入一次程式碼,只要輸入 outsideshell(); 就可以把模型叫出來,是不是很方便啊!
----------------------------------------
再重複上面的步驟,做出外面的模型,記得參數要做修改喔~
然後利用 difference(){ } 將兩個模型進行布林運算,

difference(){
translate( [0,0,0] ){ outsideshell(); }
translate( [0,0,ButtomThinkness] ) { insideshell(); }
}
放在第一個是被修剪的模型,而後面則是要修剪的模型,這樣就大功告成摟~~YA
*我在第二個模型的translate()上加入Z軸的變化,讓使用者自己去設計要不要把底封起來
----------------------------------------
----------------------------------------
----------------------------------------
▲選擇做好的 OpenSCAD 檔案
▲檔案資訊和介紹的部分一定要寫好才能夠上傳給別人看喔!!!
▲進去後的畫面,然後點擊下方的 Ting setting
















沒有留言:
張貼留言