2016年3月16日 星期三

利用 InkScape製作3D(4):合併多個 STL檔--> 名牌完成!

將之前做好的  名字.stl 及 底座.stl合併後,就可以得到最後要的名牌。
利用 MeshLab 合併成單一檔。
         

          

          
   此時名字.stl 及 底座.stl重疊了,看不到名字
   要"往上 平移",按 T 再用  滑鼠 往上拉

按 "Return" 確定
           

現在名字.stl 及 底座.stl還是2個獨立的物件,必須合併在一起:


選擇 Flatten Visible Layers



最後存檔!   Export as   *****.stl 檔


利用 InkScape製作3D(3):將.scad檔轉成 .stl檔

前一則利用 InkScape製作3D(2)製作了2個.scad檔,
現在要轉成 3D印表機的檔案格式。
利用 OpenSCAD來轉。

首先開啟檔案:
      
Design  ---     Render
   
Export as .STL 檔
  

利用 InkScape製作3D(2):2D檔案轉成 3D

將利用 InkScape製作3D(1)做好的.SVG檔,轉成 3D

                            
   得到 .scad檔
       


2個 .scad檔


利用 InkScape製作3D(1):製作2D檔案

1.製作2D檔案:InkScape

     橢圓底座
          
     調整大小:
                                   
    設定大小:
  
    製作"洞洞"
                         
    將"洞洞"放到橢圓上
                            
   對齊2個物件:
        

 減去"洞洞":選取2個物件後
    
     減去之後:
      
    打上名字:
               

       將'物件'轉為'路徑'
             
 
       現在2D的檔案製作完成!!
           
      存檔,SVG檔。

3D 列印的軟體

安裝以下4種軟體:
Inkscape
PathToOpenScad
OpenSCAD
MeshLab





Inkscape 安裝:https://inkscape.org/zh/
                                      現在可以安裝0.91版
                                      只是要下載修正檔
                                     (因為繁體中文的緣故)
             安裝完




PathToOpenScad  --將 Inkscape的 2D 轉3D
                安裝 plugin   PathToOpenScad  for Inkscape
                下載  http://www.thingiverse.com/thing:25036/#files
                   




























        下載、解壓縮後有2個檔案,
                                      
        將這2個檔案放到C槽Inkscape的資料夾裏:

          C:/Program Files/Inkscape/share/extensions 
                 











OpenSCAD:將3D檔案轉成 .STL檔

                                             http://www.openscad.org/

            









MeshLab :  可以將數個 .STL 檔合併
                   http://meshlab.sourceforge.net/

2015年11月9日 星期一

Arduino 9:超聲波測距離

超聲波感測器 HCSR04



  1. const byte trigPin = 10;  // 超音波模組的觸發腳
  2. const int  echoPin = 9;    // 超音波模組的接收腳
  3. unsigned long d;          // 儲存高脈衝的持續時間

  4. unsigned long ping() {
  5.   digitalWrite(trigPin, HIGH);   // 觸發腳設定成高電位
  6.   delayMicroseconds(5);             // 持續 5 微秒
  7.   digitalWrite(trigPin, LOW);    // 觸發腳設定成低電位
  8.  
  9.   return pulseIn(echoPin, HIGH); // 傳回高脈衝的持續時間
  10. }

  11. void setup() {
  12.   pinMode(trigPin, OUTPUT);  // 觸發腳設定成「輸出」
  13.   pinMode(echoPin, INPUT);   // 接收腳設定成「輸入」
  14.    Serial.begin(9600);                // 初始化序列埠
  15. }

  16. void loop(){
  17.   d = ping() / 58;       // 把高脈衝時間值換算成公分單位
  18.   Serial.print(d);       // 顯示距離
  19.   Serial.print("cm");
  20.   Serial.println();
  21.   delay(1000);          // 等待一秒鐘(每隔一秒測量一次)
  22. }


顯示在LCD上



  1. //-------------------------   LCD 
  2. //Library version:1.1
  3.  #include <Wire.h>
  4.  #include <LiquidCrystal_I2C.h>
  5.  #if defined(ARDUINO) && ARDUINO >= 100
  6.  #define printByte(args)  write(args);
  7.  #else
  8.  #define printByte(args)  print(args,BYTE);
  9.  #endif
  10.  LiquidCrystal_I2C lcd(0x20,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line
  11. //-------------------------

  12. //+ + + + + + + + + + +   超音波模組
  13.  const byte trigPin = 13;  // 超音波模組的觸發腳
  14.  const int echoPin = 12;    // 超音波模組的接收腳
  15.  unsigned long d;          // 儲存高脈衝的持續時間

  16.   unsigned long ping() {
  17.    digitalWrite(trigPin, HIGH);   // 觸發腳設定成高電位
  18.    delayMicroseconds(5);          // 持續 5 微秒
  19.    digitalWrite(trigPin, LOW);    // 觸發腳設定成低電位
  20.  
  21.    return pulseIn(echoPin, HIGH); // 傳回高脈衝的持續時間
  22.  }
  23. //+ + + + + + + + + + +  

  24. void setup() {
  25.     //-------------------------   LCD  
  26.      lcd.init();                      // initialize the lcd 
  27.      lcd.backlight();

  28.      lcd.setCursor(0, 0);
  29.      lcd.print   ("Distance= ");
  30.     //-------------------------   LCD  
  31.     
  32.     //+ + + + + + + + + + +   超音波模組
  33.     pinMode(trigPin, OUTPUT);  // 觸發腳設定成「輸出」
  34.     pinMode(echoPin, INPUT);   // 接收腳設定成「輸入」
  35.           //Serial.begin(9600);        // 初始化序列埠
  36.     //+ + + + + + + + + + +
  37. }


  38. void loop(){
  39.     //+ + + + + + + + + + +   超音波模組
  40.      d = ping() / 58;       // 把高脈衝時間值換算成公分單位
  41.           //Serial.print(d);       // 顯示距離
  42.           //Serial.print("cm");
  43.           //Serial.println();
  44.     //-------------------------   LCD
  45.      lcd.setCursor(9, 1);
  46.      lcd.print((unsigned long)  d  );
  47.       //  lcd.setCursor(14, 1);
  48.      lcd.print   ("cm");
  49.     //-------------------------   LCD
  50.   delay(1000);          // 等待一秒鐘(每隔一秒測量一次)
  51. }