2015年9月9日 星期三

Cura - 3D 列印切片軟體

Cura 是Ultimaker 公司所釋出的開源軟體,Cura能將STL的圖檔轉換為GCode檔案,讓3D印表機能根據轉換出的參數,進行打印.

Cura的組成有兩大部分,一部分是由Python所呈現的UI.
另一部分是C++ 做為核心的列印引擎.

Cura 的安裝包Sctipy可透過 ”package.sh ”接參數win32製作.

參考文獻:

編譯環境需要的基本軟體:
˙Windows SDK

˙7z

# 注意事項:
# 安裝Arduino的預設路徑與package.sh的可能不同
# 安裝Winavr的版本中,GNUmake.exe的版本在3.82以下有bug,須更新至4.1以上
# ARDUINO 1.6.4 不相容,需安裝ARDUINO1.0.6

If you'rerunning Windows 8 or higher, the Make in WinAVR won't work as distributed. Download this file and install it in winavr's util/bin directory afterinstalling WinAVR:
http://www.madwizard.org/download/electronics/msys-1.0-vista64.zip

WinAVR
"Date modified" is also odd for me since therelease is named "WinAVR-20100110" and I do not believe thattime-travel is possible in our universe I doubt that even this is correct ...

There is also a file named "make.exe.old" but it is waste of time touse/test that since I already know that this version is not better.

Anyway I found the workaround (to be correct it is just a workaround, not afinal solution) it is fine for me that way. We plan to move to AtmelStudio/toolchain anyway ...

Problem : #\$_OUTDIR/Lib/site-packages

------
以上為核心建置的部分
------
若只需要修改UI,可直接修改Python檔案即可.
------
Cura的安裝檔為一個壓縮檔,安裝的過程中會解壓縮檔案至目錄,並可選擇是否安裝Arduino的驅動程式.

Python的檔案結構
# 在第一次執行Cura的時候,Cura會去執行\\Cura\cura.py
# Cura.py在第一次時會去執行configWizard.py 的設定檔視窗
# 220 行 (options[5] 預設第五個選項)這是視窗選項預設的語言

例如:
def AddCombo(self, label, options):
combo = wx.ComboBox(self, -1, options[5], choices=options, style=wx.CB_DROPDOWN|wx.CB_READONLY)
text = wx.StaticText(self, -1, label)
self.GetSizer().Add(text, pos=(self.rowNr, 0), span=(1, 1), flag=wx.LEFT | wx.RIGHT)
self.GetSizer().Add(combo, pos=(self.rowNr, 1), span=(1, 1), flag=wx.LEFT | wx.RIGHT)
self.rowNr += 1
return combo

設定完成以後,設定檔的位置會被寫入
設定檔位置C:\Users\User_name\.cura

而之後每次執行都會去Load profile,執行C:\Users\User_name\.cura
內所設定的參數檔.

Resource.py 資源檔
434 行 (self.OtherRadio =self.AddRadioButton(_("測試機型")))

C:\Users\User_name\.cura\current_profile.ini 設定完預設參數

Python 程式碼 :
Cura_15.04.2\resources\machine_profiles 機器設定原始參數
Cura_15.04.2\resources\locale\zh\LC_MESSAGES\Cura.po 對照Python

參考資料:

在修改Python檔案以後,重新執行即可.

因此,若要修改UI層級的軟體,可透過修改設定檔和Python的直譯檔即可.

Cura 是透過 Protobuf與Python的UI做溝通的,Protobuf是一種簡單的數據結構,是Google內部用來做混合語言的溝通.

參考資料:

沒有留言:

張貼留言