明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: wcf

申请编一个LISP程序

  [复制链接]
发表于 2004-7-6 16:12:00 | 显示全部楼层
自己发现了个错误,改了一下:
(defun c:test (/ ss i j ent ents ang item lst str intlst xl-sort xl-isort To)
;(xl-sort lst fun) = 以取代vl-sort函数,用法相同(lsp)---------------by 无痕
(defun xl-sort (lst fun / nlst)
(foreach n lst (setq nlst (xl-isort n nlst fun)))
)
(defun xl-isort (item lst fun / k nlst)
(setq k T
nlst (apply 'append
(mapcar '(lambda (x)
(if (and K ((eval fun) item x))
(progn (setq k nil) (list item x))
(list x)
)
)
lst
)
)
)
(if k
(append lst (list item))
nlst
)
)
(defun To (entlst / str ents)
(setq str (apply 'strcat
(mapcar '(lambda (e) (cdr (assoc 1 e))) entlst)
)
)
(setq ents (subst (cons 1 str) (assoc 1 (car entlst)) (car entlst)))
(entmod ents)
(mapcar 'entdel
(mapcar '(lambda (e) (cdr (assoc -1 e))) (cdr entlst))
)
)
(setq ss (ssget '((0 . "TEXT"))))
(setq i 0)
(setq lst nil
intlst nil
)
(repeat (sslength ss)
(setq ent (ssname ss i))
(setq ents (entget ent))
(setq ang (cdr (assoc 50 ents)))
(if (setq item (assoc ang lst))
(setq lst (subst (append item (list ents)) item lst))
(setq lst (append lst (list (list ang ents))))
)
(setq i (1+ i))
)
(setq i 0)
(setq lst
(mapcar
'(lambda (e)
(cons
(car e)
(vl-sort (cdr e)
'(lambda (e1 e2)
(< (cadr (assoc 10 e1)) (cadr (assoc 10 e2)))
)
)
)
)
lst
)
)
(repeat (length lst)
(setq item (nth i lst))
(setq j 1)
(repeat (1- (length item))
(setq ents (nth j item))
(setq str (cdr (assoc 1 ents)))
(if (= (type (read str)) 'INT)
(setq intlst (append intlst (list ents)))
(if intlst
(progn
(To (reverse intlst))
(setq intlst nil)
)
)
)
(setq j (1+ j))
)
(if intlst
(To (reverse intlst))
)
(setq i (1+ i))
)
(princ)
)
 楼主| 发表于 2004-7-7 10:06:00 | 显示全部楼层
在2002下测试还是有字符乱串现象,在14下不能运行。
发表于 2004-7-8 08:28:00 | 显示全部楼层
怎么就不愿意提供一个有问题的图呢??????我好调试啊。。。
 楼主| 发表于 2004-7-11 09:17:00 | 显示全部楼层
不好意思,老出差,不能及时回贴。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
发表于 2004-7-15 09:13:00 | 显示全部楼层
???


再看看10楼的和8楼的
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-10-1 00:39 , Processed in 0.165653 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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