martinle 发表于 2022-7-5 18:44:39

非常感谢!

Lee Mac 发表于 2022-7-5 18:46:35

不错的解决方案Stefan
 
还有一种方法:
(defun c:test ( / a d e f i l n v x )
   (if (setq e (ssget "_+.:E:S" '((0 . "LWPOLYLINE") (-4 . "&=") (70 . 1))))
       (progn
         (setq l (entget (ssname e 0))
               l (cons (assoc 10 (reverse l)) l)
               f (lambda ( x ) (reverse (cdr x)))
               d 1e308 n 0
         )
         (while (setq a (assoc 10 l))
               (and v (< (setq x (distance (cdr a) (car v))) d) (setq d x i n))
               (or (and v (equal (car v) (cdr a) 1e-3))
                   (setq v (cons (cdr a) v))
               )
               (setq l (cdr (member a l))
                     n (1+ n)
               )
         )
         (setq v (f v))
         (repeat i (setq v (reverse (cons (car v) (f v)))))
         (repeat (- (/ (length v) 2) 2)
               (entmake (list '(0 . "LINE") (cons 10 (car (setq v (f (f v))))) (cons 11 (last v))))
         )
       )
   )
   (princ)
)

martinle 发表于 2022-7-5 18:51:23

谢谢李先生!
它工作得很好。
 
谢谢Martin

Stefan BMR 发表于 2022-7-5 18:57:34

谢谢李
 
和往常一样,你的解决方案很好,很简洁。
也许马丁对这两个Lisp程序都很满意,他可能画得很清楚,但我们都没有涵盖所有的例外。
尝试此多段线:
(entmakex
'(
   (0 . "LWPOLYLINE")
   (100 . "AcDbEntity")
   (100 . "AcDbPolyline")
   (62 . 3)
   (90 . 12) (70 . 1)
   (10 5.0 5.0) (10 5.0 1.0)
   (10 2.0 1.0) (10 2.0 2.0)
   (10 2.0 2.0) (10 4.0 2.0)
   (10 4.0 4.0) (10 1.0 4.0)
   (10 1.0 0.0) (10 0.0 0.0)
   (10 0.0 5.0) (10 0.0 5.0)
)
)

martinle 发表于 2022-7-5 19:00:38

你好,斯特凡
 
哦,是的

Lee Mac 发表于 2022-7-5 19:04:35

 
非常感谢。
 
 
良好捕捉-固定:
(defunc:test(/a d e f i l n v x)(if(setqe(ssget“_+:e:S”((0.“LWPOLYLINE”)(-4.&=“)(70.1))(Ql(entget(ssnamee 0)l(cons(assoc10(reversel)f(lambda(x)(reverse(x)))d 1e308 n 0)(而(a(cond(notv)(setqv(cons(cdra)v))((equal(carv)(cdra)1e-3))(
页: 1 [2]
查看完整版本: 连接的多段线角点