本帖最后由 作者 于 2006-9-14 14:00:05 编辑
下程序自动地测出我设计鞋样片的个数,
[Power=1]
; 制鞋专用 测试样板片的个数 ; 源码来自Meflying大侠, BDYCAD在应用中, ; 时间 : 2004-08-05 (defun c:test (/ ss select-spline-g) (setq ss (ssget "X" '((0 . "SPLINE") (8 . "0")))); 取得所有0层的spline曲线 (setq select-spline-g (Get_Selection_List ss)); 调用子程序把组成鞋样板片图的曲线分为一个选集组一个选集组 (princ (strcat "\n报告BDYCAD, 你当前的文件样板版的个数为" (rtos (length select-spline-g)) "个, 如有凝问请自行查正.")) (princ)) (defun HasInters (ent_1 ent_2 / ax_ent_1 ax_ent_2 intpoints) (setq ax_ent_1 (vlax-ename->vla-object ent_1) ax_ent_2 (vlax-ename->vla-object ent_2) ) (setq intpoints (vla-intersectwith ax_ent_1 ax_ent_2 acextendboth)) (setq intpoints (vlax-variant-value intpoints)) (if (> (vlax-safearray-get-u-bound intpoints 1) 0) t nil ) ) (defun Get_Inters_Name(ename ss / n i ename2 rname) (setq i 0) (setq n (sslength ss)) (while (< i n) (setq ename2 (ssname ss i)) (if (HasInters ename ename2) (progn (setq rname ename2) (setq i n) ) (setq i (1+ i)) ) ) rname ) (defun Get_Selection_List(ss / ss_New n Ename1 Ename2 Ename_List) (IF SS (PROGN (setq n (sslength ss)) (while (> n 0) (setq Ename1 (ssname ss 0)) (ssdel Ename1 ss) (setq ss_New (ssadd)) (ssadd Ename1 ss_New) (while (setq Ename2 (Get_Inters_Name Ename1 ss)) (ssadd Ename2 ss_New) (ssdel Ename2 ss) (setq Ename1 Ename2) ) (setq Ename_List (append Ename_List (list ss_New))) (setq ss_New nil) (setq n (sslength ss)) ))) (princ) Ename_List )
[/Power] |