(defun c:Tt (/ GET LEN NN NS P10 PT)
(princ "\n文字起点画线:")
(if (and (setq get (ssget '((0 . "*TEXT"))))
(setq pt (getpoint "\n指点放置点 <退出>:"))
)
(progn
(setq Len (sslength get))
(repeat Len
(setq nn (ssname get (setq Len (1- Len)))
p10 (cdr (assoc 10 (entget nn)))
ns (cons p10 ns)
)
)
(foreach x ns
(entmake (list '(0 . "LINE") (cons 10 x) (cons 11 pt)))
)
)
)
(princ)
)
追问不对哦,12345 代表的是那几条线段的端点,忘说了 12345端点的X坐标依次增大,Y坐标依次减小,多段线是12345 5个端点依次相连,大神再改改
追答不明白你是什么意思了
追问这个是画多段线前后,手工输,点太多太慢
(defun c:Tt (/ GET LEN NN NS P11 PAI X)
(princ "\n功能 [直线端点连多线段]")
(if (setq get (ssget '((0 . "LINE"))))
(progn
(setq Len (sslength get))
(repeat Len
(setq nn (ssname get (setq Len (1- Len)))
p11 (cdr (assoc 11 (entget nn)))
ns (cons p11 ns))
)
(setq pai (vl-sort ns
'(lambda (x1 x2)
(setq p1 (car x1) p3 (cadr x1))
(setq p2 (car x2) p4 (cadr x2))
(if (equal p1 p2 0.001) (> p3 p4) (< p1 p2))
)
)
)
(entmake (append (list '(0 . "LWPOLYLINE")
'(100 . "AcDbEntity")
'(100 . "AcDbPolyline")
(cons 90 (length pai))
'(70 . 0)
);list
(mapcar '(lambda (x) (cons 10 x)) pai)
);append
);entmake
);progn
);if
(princ)
)