试试吧:
 - [FONT=courier new](load "xyp_lib.vlx")
- ;|加载通用函数(可在签名栏直接下载)
- 如果已经下载xyp_lib并放到搜索路径下可以不再下载!
- 利用以下任何一种方式(首选第一种)即可加载和运行通用函数内的所有子程序:
- ★1·在acad.lsp中增加(load"xyp_lib")
- ■2·在每个程序内增加(load"xyp_lib")
- ■3·在command下,输入(load"xyp_lib")
- ■4·在菜单.mnl中增加(load"xyp_lib")
- ■5·将xyp_lib.vlx文件直接拽到cad屏幕
- [COLOR=red] ★通用函数下载地址:[/COLOR]
- [url]http://www.xdcad.net/forum/attachment.php?s=&postid=1606661[/url]
- |;
- ;;;点与线的属性互相传递问题
- (defun c:test ()
- (CMDLA0)
- (setq ss (ssget "X" '((0 . "INSERT") (8 . "GCD")))
- i -1
- )
- (while (setq s1 (ssname ss (setq i (1+ i))))
- (setq pt1 (xyp-get-Dxf 10 s1)
- dy (caddr pt1)
- pt2 (list (- (car pt1) 1) (- (cadr pt1) 1) 0)
- pt3 (list (+ (car pt1) 1) (+ (cadr pt1) 1) 0)
- )
- (setq ss1 (ssget "c" pt2 pt3)
- j -1
- )
- (command "select" ss1 "r" s1 "")
- (setq ss1 (ssget "P"))
- (if (and (setq ss1 (ssget "P"))
- (= (sslength ss1) 2)
- )
- (progn
- (while (setq s2 (ssname ss1 (setq j (1+ j))))
- (setq etype (xyp-get-Dxf 0 s2)
- la (xyp-get-Dxf 8 s2)
- )
- (if (= etype "TEXT")
- (setq s-text s2)
- (progn
- (setq s-o s2
- la1 la
- )
- )
- )
- )
- (command "chprop" s1 s-text "" "la" la1 "")
- (command "move"
- s-o
- s-text
- ""
- (list 0 0 0)
- (list 0 0 dy)
- )
- )
- (princ"此处存在物体重叠!")
- )
- )
- (CMDLA1)
- )[/FONT]
|