明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2349|回复: 11

一个LSP程序的问题?

  [复制链接]
发表于 2004-6-14 13:08:00 | 显示全部楼层 |阅读模式
这是一个求和的程序,在R14下运行没问题,为什么加载到2002下就不能用了呢?提示:"要绑定的对象不正确: T"
高手帮帮我啊!我在此谢了! (DEFUN C:gross(/ p1 p2)
(command "osnap" "")
(if (not i) (setq i (GETREAL "\n比例<1:x> x: ")))
(princ "请输入计算精度? <2>")
(setq pnumber (getint " "))
(if (not pnumber) (setq pnumber 2))
(setq p1 (getpoint "\nfirst point of the cross "))
(setq p2 (getcorner p1 "\nsecond point of the cross "))
(gross1)
(setq p1 (getpoint "\nwhere to write the weighth?"))
(setq txth (* i 3.5))
(command "text" p1 txth "0" txt)
)
发表于 2004-6-14 13:36:00 | 显示全部楼层
(gross1)呢?
发表于 2004-6-14 13:41:00 | 显示全部楼层
这个(gross1)的函数我不知出自哪里?
发表于 2004-6-14 13:45:00 | 显示全部楼层
眨了以下眼版主先回了,我多此一举!
 楼主| 发表于 2004-6-14 14:14:00 | 显示全部楼层
这是一个求和的程序,在R14下运行没问题,为什么加载到2002下就不能用了呢?提示:"要绑定的对象不正确: T"
高手帮帮我啊!我在此谢了!

(DEFUN C:gross(/ p1 p2)
(command "osnap" "")
(if (not i) (setq i (GETREAL "\n比例<1:x> x: ")))
(princ "请输入计算精度? <2>")
(setq pnumber (getint " "))
(if (not pnumber) (setq pnumber 2))
(setq p1 (getpoint "\nfirst point of the cross "))
(setq p2 (getcorner p1 "\nsecond point of the cross "))
(gross1)
(setq p1 (getpoint "\nwhere to write the weighth?"))
(setq txth (* i 3.5))
(command "text" p1 txth "0" txt)
)
(defun gross1(/ nne nn ss0 s ss)
(setq s (ssget "c" p1 p2))
(setq kk 0)
(setq nne (sslength s))
(setq nn 0 ss0 0)
(while (< nn nne)(progn
(setq s0 (ssname s nn))
(setq s1 (entget s0))
(setq ss1 (assoc '10 s1))
(setq s1 (assoc '1 s1))
(if s1 (progn
(setq s1 (cdr s1))
(setq ss1 (cdr ss1))
(setq s1(point s1))
(setq ss (atof s1))
(if (/= ss 0) (progn (grdraw ss1 (polar ss1 (/ pi 5) (* 8 i)) 1 1) (setq kk (+ kk 1)) (princ "+")(princ ss)))
(setq ss0 (+ ss0 ss))))
(setq nn (+ nn 1))))
(setq txt (rtos ss0 2 pnumber))
(progn (princ "\n共有")(princ kk)(Princ "数相加"))
)
发表于 2004-6-14 16:02:00 | 显示全部楼层
(point s1)


point呢?
 楼主| 发表于 2004-6-14 17:26:00 | 显示全部楼层
(setq p1 (getpoint "\nfirst point of the cross "))
(setq p2 (getcorner p1 "\nsecond point of the cross "))
发表于 2004-6-14 17:34:00 | 显示全部楼层
问的是point函数,这里(point s1)是函数point,参数s1,这个point函数是自定义函数
 楼主| 发表于 2004-6-15 08:44:00 | 显示全部楼层
哦,不好意思,是这个: (defun point(x / pp xx t)
(setq pp (strlen x) t 1)
(while (< t pp)
(if (= (substr x t 1) ";")
(setq x (substr x (+ t 1)) t pp))(setq t (+ t 1))
)
(setq pp (strlen x) t 1)
(while (< t pp)
(setq xx (substr x t 2))
(if (= xx "。")
(progn (setq x (strcat (substr x 1 (- t 1)) "." (substr x (+ t 2))) t pp))
)(setq t (+ t 1))
)(setq x x)
) 在VISUAL LISP测试: 警告: 内置符号的重定义: T 小弟是菜鸟,请斑竹指点迷津!谢了!
发表于 2004-6-15 09:17:00 | 显示全部楼层
t是系统保留字符,你不能给它重定义,就像setq、if一样,T是不能作为变量的


(setq t (+ t 1))这里的T要换成别的变量(如果别的地方有,或有类似的,都要换掉)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-10-1 04:17 , Processed in 0.178292 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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