乐筑天下

搜索
欢迎各位开发者和用户入驻本平台 尊重版权,从我做起,拒绝盗版,拒绝倒卖 签到、发布资源、邀请好友注册,可以获得银币 请注意保管好自己的密码,避免账户资金被盗
查看: 57|回复: 2

[密技]:如何不使用sendcommand在vba中对lisp求值

[复制链接]

37

主题

297

帖子

15

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
449
发表于 2002-9-26 10:25:00 | 显示全部楼层 |阅读模式
寄件者:Mark Holder (holderm@atscorporation.com) 主旨:Re: Calling Autolisp Programs From VB - Map 2000 新闻群组:autodesk..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:
>
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.
>
Of interest in it is the phrase &quotarameters 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:
>The Visual LISP white paper on Autodesk's web page has an example in VBA that should work.
>
回复

使用道具 举报

37

主题

297

帖子

15

银币

后起之秀

Rank: 20Rank: 20Rank: 20Rank: 20

铜币
449
发表于 2002-9-26 10:37:00 | 显示全部楼层
http://www.xdcad.com/forum/showthread.php?s=a4cbf78469d92225e0118bb95af26aa9&postid=71141#post71141
回复

使用道具 举报

0

主题

15

帖子

2

银币

初来乍到

Rank: 1

铜币
15
发表于 2010-7-1 11:07:00 | 显示全部楼层
优点
回复

使用道具 举报

发表回复

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 微信公众平台

  • 扫描访问手机版

  • 点击图片下载手机App

QQ|关于我们|小黑屋|乐筑天下 繁体中文

GMT+8, 2025-7-1 12:47 , Processed in 0.286566 second(s), 58 queries .

© 2020-2025 乐筑天下

联系客服 关注微信 帮助中心 下载APP 返回顶部 返回列表