- 积分
- 6483
- 明经币
- 个
- 注册时间
- 2002-4-17
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
寄件者:Mark Holder (holderm@atscorporation.com) 主旨:Re: Calling Autolisp Programs From VB - Map 2000 新闻群组:autodesk.AutoCAD.customization.vba View this article only 日期:1999/06/10
Tony,
Thanks once again for the info. For others who may be interested, I went looking and found the
following link:
http://www.autodesk.com/products/ac...iles/avlisp.exe
The following is an excerpt:
<<snip>>
Visual LISP as an ActiveX Server
Visual LISP can function as an ActiveX server. This is useful when using VBA dialogs to control
Visual LISP applications. For instance, a programmer can create dialogs using the VBA visual
tools for layout. They can then have the actions invoke Visual LISP.
Any Visual LISP function may be invoked and any symbol may have its value referenced or set.
Parameters and results are all variants. In the following example
Sub Hello()
Set vla = CreateObject("VL.Application.1")
Set vld = vla.ActiveDocument
Set vl_read = vld.Functions.Item("read")
Set vl_eval = vld.Functions.Item("eval")
Set vl_hello = vl_read.funcall("(defun hello (x)(print x))")
Set vl_hello = vl_eval.funcall(vl_hello)
Set vl_hello = vld.Functions.Item("hello")
ret = vl_hello.funcall("world")
MsgBox ret, vbOKOnly
End Sub
we obtain access to Visual LISPs read and eval functions. We then use those to define a hello
function, which we then call, displaying its return value in a message box.
<<snip>>
Of interest in it is the phrase "arameters and results are all variants". We may get better
results by declaring our variables as variants (which can contain an object) rather than declaring
them directly as objects.
I'm more optimistic about calling VLisp from VB after seeing Autodesk endorse the idea.
Tony Tanzillo wrote:
<<snip>>The Visual LISP white paper on Autodesk's web page has an example in VBA that should work.
<<snip>> |
|