只需一步,快速开始
(defun C:tt ( / edge ep i int line linename liness sp) (vl-load-com) (while (not edge) (setq edge (car (entsel "\n 请选择边界线:"))) (redraw edge 3) ) (prompt "\n 请选择需要延伸或者剪切的直线段: ") (if (setq i 0 liness (ssget '((0 . "LINE"))) ) (repeat (sslength liness) (setq line (entget (ssname liness i)) sp (cdr (assoc 10 line)) ep (cdr (assoc 11 line)) ) (if (setq int (nth 0 (x_intlst edge (ssname liness i) acExtendOtherEntity))) (if (< (distance int sp) (distance int ep)) (entmod (subst (cons 10 int)(assoc 10 line) line)) (entmod (subst (cons 11 int) (assoc 11 line)line)) ) ) (setq i (1+ i)) ) (princ "\n 没有找到需要被延伸或者剪切的直线段") ) (redraw edge 4) ) (defun x_intlst (obj1 obj2 param / intlst1 intlst2 ptlst) (if (= 'ENAME (type obj1)) (setq obj1 (vlax-ename->vla-object obj1)) ) (if (= 'ENAME (type obj2)) (setq obj2 (vlax-ename->vla-object obj2)) ) (setq intlst1 (vlax-variant-value (vla-intersectwith obj1 obj2 param))) (if (< 0 (vlax-safearray-get-u-bound intlst1 1)) (progn (setq intlst2 (vlax-safearray->list intlst1)) (while (> (length intlst2) 0) (setq ptlst (cons (list (car intlst2) (cadr intlst2) (caddr intlst2)) ptlst ) intlst2 (cdddr intlst2) ) ) ) ) ptlst ) (princ)
您需要 登录 才可以下载或查看,没有账号?注册
使用道具 举报
Andyhon 发表于 2016-7-9 10:59 若能上传程序运行前及完成后的文件 (*.Dwg) 作为参考更能确定代码...
本版积分规则 发表回复 回帖后跳转到最后一页
小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 ) ©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途
GMT+8, 2025-5-20 08:07 , Processed in 0.159153 second(s), 26 queries , Gzip On.
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.