Orcad Capture 使用Tcl/Tk 程式開發技巧總覽
1. 官方的使用說明檔案
https://www.ema-eda.com/resources/library/orcad-capture-tcltk-api-reference-guide
2. 如何開啟Capture Command Window
View->Toolbar->Command Window
3. 顯示Tcl 版本
puts $tcl_version or info tclversion
4.將原始碼加密
16.6 版本中加密指令:
orcad::encrypt <input_file> [output_file]
17.2-2016版本後加密指令:
tclcompiler86.exe <TCL File Path> [output_file]
5. 自動建立索引檔案(pkgIndex.tcl)的命令格式
pkg_mkIndex ?-direct? ?-lazy? ?-load pattern? ?-verbose? ?--? dir ?pattern ...? EX: pkg_mkIndex . *.tcl
6.讀取MAC Address的資料
GetMACAddresses
7. TCL string 和 CString 轉換
3.2.1.3 String type conversion
As a general rule, almost all the Capture database commands take the “string” parameter as "CString". There are helper methods available to convert a character array (TCL string) to a CString. You will have to call DboTclHelper_sMakeCString command for this like the following-
set lName [DboTclHelper_sMakeCString]
# now suppose you have the library object as lLib, then the appropriate call would be
$lLib GetName $lName
There is another helper method DboTclHelper_sGetConstCharPtr that converts CString back to TCL string. Hence, a subsequent command “puts *DboTclHelper_sGetConstCharPtr $lName+” will convert the library name to a TCL string and then “puts” will print it on the command shell.
set lString [DboTclHelper_sMakeCString "output string"] puts [DboTclHelper_sGetConstCharPtr $lString]
