明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1329|回复: 4

[求助]删重叠的LINE,在线等,请帮忙!!!

[复制链接]
发表于 2008-9-12 12:11:00 | 显示全部楼层 |阅读模式

两根“LINE”,第一条的起点的X,Y,Z和第二条的终点的X,Y,Z一样的,第一条的终点的X,Y,Z和第二条的起点的X,Y,Z一样的,如何处理删除其中一条,只留一条啊!!

这是我写的,有毛病!!ss_del总为空。

(defun c:del_line(/ n m)
  (setq ss_line (ssget "x" (list(cons 0 "LINE"))) n 0)
  (setq ss_del (ssadd))
  (if ss_line
  (progn
  (repeat (sslength ss_line)
  (setq name_line (ssname ss_line n))
  (setq start_point (cdr (assoc 10 (entget name_line))))
  (setq   end_point (cdr (assoc 11 (entget name_line))))
  (setq m n)
  (while (< m (sslength ss_line))
  (setq name_line_ch (ssname ss_line m))
  (setq start_point_ch (cdr (assoc 10 (entget name_line_ch))))
  (setq   end_point_ch (cdr (assoc 11 (entget name_line_ch))))
  (if (and (= start_point end_point_ch) (= end_point start_point_ch))
  (progn
  (ssadd name_line_ch ss_del)
  (setq m (+ m 1))
  );end progn
  (setq m (+ m 1))
  );end if
  );end while
  (setq n (+ n 1))
  );end repeat
  );end progn
  );end if
  (command "erase" ss_del "")
  (princ)

)

发表于 2008-9-12 13:23:00 | 显示全部楼层
(defun c:del_line(/ ss_line n name_line ps ps2 lst)
  (setq ss_line (ssget "x" (list(cons 0 "LINE"))))
  (repeat (setq n (sslength ss_line))
    (setq n (1- n))
    (setq name_line (ssname ss_line n))
    (setq ps (list (cdr (assoc 10 (entget name_line)))
                   (cdr (assoc 11 (entget name_line)))
             )
    )
    (setq ps2 (reverse ps))
    (if (vl-catch-all-error-p
          (vl-catch-all-apply
            '(lambda ()
               (foreach x lst
                 (if (or (equal ps x 0.000001)
                         (equal ps2 x 0.000001))
                   (exit)
                 )
               )
             )
          )
        )
      (entdel name_line)
      (setq lst (cons ps lst))
    )
  )
)
回复 支持 1 反对 0

使用道具 举报

 楼主| 发表于 2008-9-12 13:46:00 | 显示全部楼层

谢谢

发表于 2008-9-12 16:31:00 | 显示全部楼层

要LSP吗?有自带的命令啊  OVERKILL

 楼主| 发表于 2008-9-13 07:10:00 | 显示全部楼层
我 知道,我想怎么用程序实现,但(command "overkill" ss_line "")不行。。。。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-12-26 04:45 , Processed in 0.185860 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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