llsheng_73 发表于 2022-6-17 11:13:00

本帖最后由 llsheng_73 于 2022-6-17 11:25 编辑

(defun s2e(s / n lst)(if(=(type s)'pickset)(repeat(setq n(sslength s))(setq n(1- n)lst(cons(ssname s n)lst)))))
(defun chains(es fuz / e a b s pts)
(setq s(ssadd))
(while es
    (setq e(car es)es(cdr es)
          p1(mapcar'+'(0 0)(vlax-curve-getStartPoint e))p2(mapcar'+'(0 0)(vlax-curve-getendPoint e)))
    (foreach a(S2E(ssget"CP"(list p1(list(car p1)(cadr p2))p2(list(car p2)(cadr p1)))'((0 . "arc,*spline,*polyline,line"))))
      (or(SSMEMB a s)
         ((lambda()
            (setq p1(mapcar'+'(0 0)(vlax-curve-getStartPoint a))
                  p2(mapcar'+'(0 0)(vlax-curve-getendPoint a)))
            (and(vl-some'(lambda(x)(or(equal p1 x fuz)(equal p2 x fuz)))pt)
                (setq es(cons a es)pt(vl-list* p1 p2 pt))
                (ssadd a s)))))))
(sssetfirst'nil s))

(defun c:tt()
(chains(s2e(ssget'((0 . "arc,*spline,*polyline,line"))))0.1))

阿猪蛋 发表于 2023-5-22 14:48:55

好程序,正在找一个能选择首尾相连线段的。

sandyvs 发表于 2024-6-29 23:04:39

llsheng_73 发表于 2022-6-17 11:13


得出的是空的,麻烦有时间看下
页: 1 2 3 4 [5]
查看完整版本: 首尾相连的N条直线 选中其中任何一条都能选中N条线段 如何用lisp实现啊