- 积分
- 256
- 明经币
- 个
- 注册时间
- 2002-9-20
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|

楼主 |
发表于 2003-1-2 15:34:00
|
显示全部楼层
vl_read和funcall其什么作用?没搞懂
我把里面的那段vba代码贴到acad的vba编辑器里运行,只是出来个world的消息框,command后打了个world的字符串,没搞懂是什么意思,这段代码说明了什么问题?
vl_read和funcall其什么作用? acad的帮助文件里也没有说明,什么地方有这个说明?
如何不使用sendcommand在vba中对lisp求值
寄件者: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>> |
|