明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1588|回复: 2

我想用vba调用lisp编写的一个带有参数的程序????

[复制链接]
发表于 2005-4-21 16:35:00 | 显示全部楼层 |阅读模式

窗口代码如下:

Private Sub CmdExit_Click()
Unload Me
End
End Sub

Private Sub CmdOK_Click()
ThisDrawing.SendCommand "(load " & """ c:/vba/cl "")"
cldialog.Hide
ThisDrawing.SendCommand "(cl " & gp_txtz.Text & " " & gp_txtm.Text & " " & gp_txta.Text & ")" & vbCr
End Sub

lsp程序:

(defun cl(m a z / po ppo pppo p1 p2 p3 p4 p5 str)
(setvar "cmdecho" 0)
(setq po '(0 0))
(setq hup m)
(setq hdn (* 1.25 m))
(setq xuq (/ hup (tan a)))
(setq xdn (/ hdn (tan a)))
(setq p1 (list (- (car po) xdn) (- (cadr po) hdn)))
(setq p2 (list (+ (car po) xup) (+ (cadr po) hup)))
(setq ppo (polar po 0 (* 0.5 pi m)))
(setq p3 (list (- (car ppo) xup) (cadr p2)))
(setq p4 (list (+ (car ppo) xdn) (cadr p1)))
(setq pppo (polar po 0 (* pi m)))
(setq p5 (list (- (car pppo) xdn) (cadr p4)))
(command "layer" "s" 0 "")
(command "pline" p1 p2 p3 p4 p5 "")
(command "array" po "" "" 1 z (* pi m))
(command "pedit" "l" "j" "all" "" "")
(command "layer" "n" "l" "c" 1 1 "l" "center" 1 "s" 1 "")
(setq str (strcat "模数:"
(rtos m)
"齿数:"
(rtos z)
"齿顶角:"
(rtos a)
)
)
(command "line"
(polar po pi (* pi 0.25 m))
(polar po 0 (* z pi m))
""
)
(command "text" (polar pppo (* pi 1.75) (* pi m)) 7 0 str)
(command "zoom" "e")
(command "layer" "s" 0 "")
)


(defun tan (a)
(setq x (- 90.0 a))
(setq x (* x (/ pi 180.0)))
(setq kk (/ (sin x) (cos x)))
)

当我运行cldialog.dvd时却出现下面的情况

命令: (load " c:/vba/cl ")(cl 5 3 20)
; 错误: LOAD 失败: " c:/vba/cl "

请问怎么解决???

发表于 2005-4-21 16:42:00 | 显示全部楼层
扩展名也要写上
 楼主| 发表于 2005-4-25 10:21:00 | 显示全部楼层
谢谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-17 06:19 , Processed in 0.149015 second(s), 25 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表