- UID
- 5280
- 积分
- 9466
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-5-18
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
Question
My database field contains a Variant, which has ActiveX VarType as vbDate. For
example, the constant value is 14. How do I use the actual data value returned
from my database function ?
Answer
AutoLISP does not support all the Variant Data types made available to it though
the ActiveX COM inte**ce. For purposes of this solution, AutoLISP only supports
the following traditional types:
AutoLISP Reference -> type
Data type Description
ENAME Entity names
INT Integers
REAL Floating-point numbers
STR Strings
SYM Symbols
In addition, AutoLISP supports these new data types for AutoCAD 2000:
SAFEARRAY Safearray
VARIANT Variant
VLA-object ActiveX objects
(Please note that there are additional AutoLISP types listed in the
documentation.)
Several functions have been added to Visual Lisp for AutoCAD 2000 that will
assist you in converting from the Variant Data Type returned by ActiveX to
standard AutoLISP data types:
SAFEARRAY:
(vlax-make-safearray type '(l-bound . u-bound)
(vlax-safearray-fill var 'element-values)
(vlax-safearray-get-dim var)
(vlax-safearray-get-element var element...)
(vlax-safearray-get-l-bound var dim)
(vlax-safearray-get-u-bound var dim)
(vlax-safearray-put-element var index... value)
(vlax-safearray-type var)
(vlax-safearray->list var)
VARIANT:
(vlax-make-variant [value] [type])
(vlax-variant-change-type var type)
(vlax-variant-type var)
(vlax-variant-value var)
VLA-object:
(vlax-ename->vla-object entname)
(vlax-vla-object->ename obj)
To convert from a Variant Data value, you could use a genericLISP function as in
the following code that handles several variant data types, and converts the
variants into strings:
The vlax-vbDate variant type is not a supported AutoLISP data type, but the code
converts the variant value directly into a string.
For more information on this topic, refer to the following sections of the
documentation:
Visual Lisp Developer's Guide -> Chapter 6 -- Working with ActiveX -> Using
Visual LISP Functions with ActiveX Methods -> Converting AutoLISP Data Types to
ActiveX Data Types -> Working with Variants
Visual Lisp Developer's Guide -> Chapter 6 -- Working with ActiveX -> Using
Visual LISP Functions with ActiveX Methods -> Converting AutoLISP Data Types to
ActiveX Data Types -> Converting Other AutoLISP Data Types for ActiveX Methods
See DevNote #53398 for additional AutoLISP code that demonstrates the
supported Variant Data Types and their values.
);odtoxd
|
评分
-
查看全部评分
|