明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1496|回复: 2

[讨论] 【已解决】求助:延伸然后剪切相交程序

[复制链接]
发表于 2013-12-9 19:21 | 显示全部楼层 |阅读模式
本帖最后由 丽丽星空 于 2014-2-21 17:01 编辑

框选4根线,然后完成相交剪切,求大侠帮忙。谢谢!

本帖子中包含更多资源

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

x
 楼主| 发表于 2013-12-10 16:34 | 显示全部楼层
自己顶起!

点评

仅仅是为求编写程序 在此区会顶的费力些 http://bbs.mjtd.com/thread-100603-1-1.html  发表于 2013-12-10 16:54
 楼主| 发表于 2014-2-21 16:51 | 显示全部楼层
本帖最后由 丽丽星空 于 2014-2-21 16:58 编辑

还是自己来!
在版主XIAOXIANG提供的源码基础上修改而来,原帖见http://bbs.mjtd.com/forum.php?mod=viewthread&tid=92533&page=3#pid512194


  1. (defun c:tt ()
  2.   (defun *error* (msg)
  3.   (if  bound1 (redraw bound1 4))
  4.   (princ msg)      
  5.   (princ)
  6.   )
  7.   (vl-load-com)
  8.   (or *acdoc*
  9.       (setq *acdoc* (vla-get-ActiveDocument (vlax-get-acad-object)))
  10.   )
  11. (setq i 0)
  12.   
  13.   (if (and (setq bound (car (clh-entsel "\n选电气桥架直线: " ":S" '((8 . "电-*") (0 . "LINE")) "\n非电气桥架直线:" ))) (setq bound1 bound)
  14.     (setq bound (vlax-ename->vla-object bound))
  15.       )
  16. (progn
  17.     (redraw bound1 3)
  18.    
  19.     (if (ssget '((0 . "LINE") (8 . "电-*")))
  20.       (progn
  21. (vla-StartUndoMark *acdoc*)
  22. (vlax-for l (vla-get-ActiveSelectionSet *acdoc*)
  23.    (setq int (vlax-invoke bound 'IntersectWith l acExtendOtherEntity))
  24.    
  25.      (if (= i 0)
  26.         (setq pt1 int)
  27. (setq pt2 int)
  28. )
  29.        (setq i (+ i 1))
  30.    (while int
  31.          
  32.      (setq pt  (list (car int) (cadr int) (caddr int))
  33.     int (cdddr int)
  34.      )
  35.      (if (< (distance (vlax-get l 'StartPoint) pt)
  36.      (distance (vlax-get l 'EndPoint) pt)
  37.   )
  38.        (vlax-put l 'StartPoint pt)
  39.        (vlax-put l 'EndPoint pt)
  40.      )
  41.    )
  42. )
  43. (COMMAND "BREAK" bound1 pt1 pt2)
  44. (vla-EndUndoMark *acdoc*)
  45.       )
  46.     ))
  47.   )
  48.   (redraw bound1 4)
  49.   (princ)
  50. )

  51. ;;功能:带提示、关键字、过滤表、选择错误时的提示并且会亮显所选对像的entsel
  52. ;;用法:( clh-entsel  提示信息  关键字  过滤表  选择错误时提示)
  53. ;;举例:(clh-entsel  "\n请选择一个圆:"  "A B C"   '((0 . "circle"))  "\n所选对像不符合要求!请重新选择:")
  54. ;;说明:过滤表与ssget的过滤表相同
  55. (defun clh-entsel (msg key fil ermsg / el ss)
  56.   (while (and (setvar "errno" 0)
  57.            (not (and (setq el (apply '(lambda (msg key) (initget key) (entsel msg)) (list msg key)))
  58.             (if (= (type el) 'str)
  59.                 el
  60.             (if (setq ss (ssget (cadr el) fil))
  61.                ss
  62.             (progn (princ ermsg) (setq ss nil))
  63.             );if
  64.          );if
  65.      );and
  66.      );not
  67.      (/= (getvar "errno") 52)
  68.    );and
  69.   );while
  70.    el
  71. )


您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-8 11:14 , Processed in 2.163993 second(s), 34 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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