明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

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

如何调整绘图顺序?

  [复制链接]
 楼主| 发表于 2004-2-13 13:30:00 | 显示全部楼层
无痕:


                                         能不能帮忙完善?只要中途退出无重合线(按ESC退出),并且速度快一点。先谢了!
 楼主| 发表于 2004-2-18 18:33:00 | 显示全部楼层
请各位高手帮忙完善此程序?只要中途退出无重合线(按ESC退出),并且速度快一点。先谢了! (defun c:test()
(command "-layer" "n" "order" "s" "order" "c" "0" "" "")
(setq ss (ssget))
(setq nname "")
(setq pp '(0.0 0.0 0.0))
(setq point '(0.0 0.0 0.0))
(setq k 0)
(setq d 0)
(while (> (sslength ss) 0)
(print (sslength ss))
(setq k 0)
(setq dis 2000.0)
(setq cha_pe 0)
(while (< k (sslength ss))

(setq name (ssname ss k))
(setq enta (entget name))
(setq shap (cdr (assoc 0 enta)))
(if (= shap "LINE")
(progn
(setq ps (cdr (assoc 10 enta)))
(setq pe (cdr (assoc 11 enta)))
)
)
(if (= shap "ARC")
(progn
(setq center (cdr (assoc 10 enta)))
(setq astart (cdr (assoc 50 enta)))
(setq rad (cdr (assoc 40 enta)))
(setq aend (cdr (assoc 51 enta)))
(setq ps (mapcar '+ center (list (* rad (cos astart)) (* rad (sin astart)))))
(setq pe (mapcar '+ center (list (* rad (cos aend)) (* rad (sin aend)))))
)
)
(setq change 0)
(if (or (/= dis 0.0) (or (= shap "LINE") (= shap "ARC")))
(progn
(if (> dis (distance point ps))
(progn
(setq dis (distance point ps))
;(print dis)
(setq pp pe)
(setq d k)
(setq cha_pe 0)
(setq change 1)
)
)
(if (> dis (distance point pe))
(progn
(setq dis (distance point pe))
;(print dis)
(setq pp ps)
(setq d k)
(setq cha_pe 1)
(setq change 1)
)
)

)
)

(if (= change 1) (setq obj enta))
(if (= dis 0)
(setq k (sslength ss))
(setq k (1+ k))
)
)

(setq cc (entget(ssname ss d)))
(if (= cha_pe 1)
(progn
(setq shap (cdr (assoc 0 cc)))
(if (= shap "LINE")
(progn
(setq aa (cdr(assoc 10 cc)))
(setq bb (cdr(assoc 11 cc)))
(setq cc (subst '(list 11 aa) '(list 11 bb) cc))
(setq cc (subst '(list 10 bb) '(list 10 aa) cc))
)
(if (= shap "ARC")
(progn
;(print "pass2")
(setq aa (cdr(assoc 50 cc)))
(setq bb (cdr(assoc 51 cc)))
;(print (cons 50 bb))
(if (> aa 0.0)
(setq aa (- aa 6.2831853))
(setq aa (+ aa 6.2831853))
)
(if (> bb 0.0)
(setq bb (- bb 6.2831853))
(setq bb (+ bb 6.2831853))
)
(setq cc (subst (cons 50 bb) (cons 50 aa) cc))
(setq cc (subst (cons 51 aa) (cons 51 bb) cc))
)
)
)
)
)
(setq cc (subst (cons 8 "order") (assoc 8 cc) cc))
(entmake cc)

(ssdel (ssname ss d) ss)


(setq point pp)


)
(command "-layer" "off" "order" "y" "")
(command "erase" "p" "")
(command "-layer" "on" "order" "")
(princ)
) (command "erase" "p" "")最好用其它程序代替。
发表于 2005-5-24 01:18:00 | 显示全部楼层
请问,这个文件加载了后,该怎么进行操作,可以看见效果啊?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-17 08:19 , Processed in 0.175877 second(s), 18 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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