OpTaliX包含宏語言,允許自定義分析和計算。宏語言包括以下領域:
在任何需要數字輸入項的地方使用算術表達式。
可以檢索程序的內部資料庫和能被重複使用的算術表達式,有權訪問廣泛範圍的透鏡參數和性能數據。
訪問最常用的數學函數(sin, tan, cos, sinh, cosh, cosh, tanh, asin, acos, atan, sqrt, exp, log, log10, logn, besj0, besj1, besjn, abs, min, max, aint, anint)
用戶定義的變量和函數。
將參數傳遞給宏。
在其他宏文件中包含宏,並從基本宏或命令構建複雜任務。
循環結構:DO - ENDDO和WHILE - ENDWHILE
條件結構:IF - ELSE - ELSEIF - ENDIF
文件和數據處理:打開,關閉,讀,寫/列印。
在OpTaliX中,宏是一個序列,在文件中它是一個算術表達式,可以對資料庫項目進行存儲。在整個程序中,宏功能都可使用。例如,在命令行中,優化函數的定義和自定義的圖像。從指令或者GUI模式中運行宏。
Examples
下面的示例顯示了一些宏功能,從上到下不斷增加複雜性。名為"mymacro.mac" 的宏被如下命令行執行:
run mymacro.mac 3 0.546
在上面的示例命令中,有兩個參數被傳遞給宏。宏也可以從菜單中執行(運行)。下面是一個宏文件中的一些注釋示例條目:
! Example macroThe character ! indicates a comment. This line is not executed.
$x = 15 Defines a user-defined variable and assigns a value. User-defined variables always begin with the $-character.@xxx = sqrt($x)+[efl] Defines a user-defined function. User-defined functions always begin with the @-character.
res c:\temp\demo.otxRestores an optical system
lis ; vie; fanMultiple commands/expressions can be entered in a single line, separated by semicolons.sca sa 2*piUse previously defined constants in expressions. This command scales all surfaces (sa) by 2p.wl w%1 %2Use parameters (%1, %2), which have been passed to the macro from the command line. From the parameters given above, the command translates to: wl w3 0.546print 'Radius of surface 2 is:' [rdy s2]Retrieve lens parameter or performance parameter and use it in other expressions. Here rdy s2 is the radius on surface 2.thi s3 sqrt(2)*[thi s2]Use lens database items in more complex expressions and assign it to other lens parameter.
print 'Square root of 2: ' 2*sqrt( &
2)Span expressions over several lines. Continuation is defined by the & character.
do $x = 1,9,2
print $x sqrt($x)
enddoDO-loop construct. Nesting depth is 20.if ($a > 3) then
print '$ a is greater than 3'
else
print '$ a is less than or equal to 3'
endifIF construct. Nesting depth is 20.
內部函數
OpTaliX也存在一個廣泛的內在函數集,可以在命令行中使用,在宏中,在定義優化約束或指定鏡頭描述參數:
sin(r)sine of angle in radianscos(r)cosine of angle in radianstan(r)tangent of angle in radiansexp(x)exlog(x)natural logarithmlog10(x)common logarithmlogn(n,x)logarithm base nsqrt(x)square rootacos(r)arccosineasin(r)arcsineatan(r)arctangentcosh(r)hyperbolic cosinesinh(r)hyperbolic sinetanh(r)hyperbolic tangent
besj0(r)Bessel function 1st kind, order 0besj1(r)Bessel function 1st kind, order 1besjn(n,x)Bessel function 1st kind, order naint(x)truncate to a whole numberanint(x)real representation of the nearest whole numberabs(x)absolute valuemin(a,b)minimum valuemax(a,b)maximum value
相關技術文章:
OpTaliX ISO元件製圖
OpTaliX 玻璃圖和玻璃管理器
OpTaliX 光學軟體操作界面介紹
OpTaliX 鬼像分析
OpTaliX表面孔徑
為什麼要選用OpTaliX ?!
OpTaliX 優化
OpTaliX 光學成像與照明設計軟體
如果您需要了解更多 OpTaliX 軟體相關信息,請點擊文末「閱讀原文」諮詢。
聯合光學科技有限公司是一家專業的光學產品與軟體研發、銷售及技術諮詢服務的公司。涉及領域包括幾何光學,物理光學等方面的模擬和仿真,已蛻變為一家國際化的高科技專業技術服務公司。為廣大客戶提供全方位的光學軟體產品服務和專業化的軟體課程培訓。
技術交流
長按識別二維碼