The Application object provides the SetSystemVariable and GetSystemVariable methods for setting and retrieving AutoCAD system variables. For example, to assign an integer to the MAXSORT system variable, use the following code:
Application 对象提供了 SetSystemVariable 和 GetSystemVariable 方法设置和获得 AutoCAD 系统变量。例如,若要指定一个整数级 MAXSORT 系统变量,请使用如下代码:
'' 从一个系统变量获得一个当前值 Get the current value from a system variable
Dim nMaxSort as Integer = Application.GetSystemVariable("MAXSORT")
'' 为系统变量设置一个新值 Set system variable to new value
Application.SetSystemVariable("MAXSORT", 100)
// 从一个系统变量获得一个当前值 Get the current value from a system variable
int nMaxSort = System.Convert.ToInt32(Application.GetSystemVariable("MAXSORT"));
// 为系统变量设置一个新值 Set system variable to new value
Application.SetSystemVariable("MAXSORT", 100);